[英]Angular cli copying files out of the assets folder
can some one tell my why angular cli project is copying graphic files from the assets folder into the root of the output folder? 有人可以告诉我为什么angular cli项目将图形文件从资产文件夹复制到输出文件夹的根目录吗?
For example I have a graphic at src/assets/background.jpg, and I reference that graphic from my src/styles.css file: 例如,我在src / assets / background.jpg上有一个图形,并且从我的src / styles.css文件中引用了该图形:
body {
background-image: url(./assets/background.jpg);
}
Now when I build my project using: 现在,当我使用以下命令构建项目时:
ng build --prod --output-hashing=none --output-path=target/output
I now have the following generated output structure: 我现在具有以下生成的输出结构:
target/ouput
...
background.jpg
assets
background.jpg
The css is refernecing the copied version of the background file and everything works, but now I have two copies of the file. CSS正在引用后台文件的复制版本,并且一切正常,但是现在我有该文件的两个副本。 How can I reference this file from assets/background.jpg so I don't get two copies?
如何从assets / background.jpg引用此文件,所以我得不到两个副本?
Thanks; 谢谢; David
大卫
Because the idea is that everything you need to deploy will be in the specified output folder. 因为这样的想法是,您需要部署的所有内容都将位于指定的输出文件夹中。 Then you can deploy by copying the output folder to your server.
然后,您可以通过将输出文件夹复制到服务器来进行部署。
If the --prod build didn't copy the file, it would not be in the set of output files and would not get deployed without extra steps on your part. 如果--prod构建未复制文件,则它将不在输出文件集中,并且无需您执行额外的步骤就不会进行部署。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.