使用 Angular-CLI 构建复制文件/目录 [英] Using Angular-CLI build to copy a file / directory
本文介绍了使用 Angular-CLI 构建复制文件/目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法让 angular-cli 的 ng buil --prod
命令也复制一个文件/目录到 dist 文件夹?
Is there a way to make angular-cli's ng buil --prod
command to also copy a file/directory to the dist folder?
我的项目包含一个server"文件夹和一个根目录下的config.js"文件,我需要将它们复制到dist",这样在构建时,我不需要记住复制这些目录
My project includes a "server" folder, and a "config.js" file at root, and I need them to be copied to "dist" such that when building, I don't need to remember to copy those directories
推荐答案
在 assets 对象上的 angular-cli.json 上添加要包含的文件夹,例如:
On your angular-cli.json on assets object add the folders you want to include like:
注意:对于 Angular 9,这应该放在 angular.json 文件中
Note : For Angular 9, this should be placed on angular.json file
"assets": [
"assets",
"favicon.ico",
"META-INF",
"WEB-INF"
]
这篇关于使用 Angular-CLI 构建复制文件/目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文