[英]How to add own css and js files to the build of Angular 2 App?
Angular 2 automatically adds link to styles.css to the head and some scripts to the end of body of index.html. Angular 2自动将styles.css的链接添加到头部,将一些脚本添加到index.html的主体末尾。
For example: 例如:
<script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="polyfills.bundle.js"></script>
<script type="text/javascript" src="styles.bundle.js"></script>
<script type="text/javascript" src="vendor.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js"></script>
Where I can configure Angular to add also my own .css and .js files to the build? 我可以在哪里配置Angular以将我自己的.css和.js文件添加到构建中? PS I'm using CLI PS我正在使用CLI
Open your angular-cli.json
file and find assets
array. 打开angular-cli.json
文件并查找assets
数组。 Push the links inside of the files you want the build
process to include. 推送您希望build
过程包含的文件内的链接。
"assets": [
"assets",
"favicon.ico",
"styles.css",
"d3.js",
],
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.