假设我需要在index.html
过程中将abc.xyz
重命名为ng build
,这可能吗?如果是这样,我该怎么做呢?
我假设我必须修改package.json
build
脚本,并且可能使用管道,但我无法通过查看Angular CLI github或通过NPM的网站。谷歌也没有帮助过我......我一定不能问正确的问题。
答案 0 :(得分:2)
在CLI
中没有类似的东西你可以重命名文件,但是你可以通过使用自定义的npm脚本来做到这一点。如何做到这一点有多种选择:
如果您在Windows
,则可以在您的npm move
中使用build script
cmd命令:
"build": "ng build && move dist\\index.html dist\\abc.xyz"
如果您在Linux
,则必须使用mv
代替:
"build": "ng build && mv dist/index.html dist/abc.xyz"
然后通过运行npm run build
,您将获得所需的结果。
如果需要,您也可以使用cash-mv npm包,这样build script
就会cross platform
(Linux版本的脚本对所有平台都有效)。< / p>