簡體   English   中英

如何將自己的css和js文件添加到Angular 2 App的構建中?

[英]How to add own css and js files to the build of Angular 2 App?

Angular 2自動將styles.css的鏈接添加到頭部,將一些腳本添加到index.html的主體末尾。

例如:

<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>

我可以在哪里配置Angular以將我自己的.css和.js文件添加到構建中? PS我正在使用CLI

打開angular-cli.json文件並查找assets數組。 推送您希望build過程包含的文件內的鏈接。

"assets": [
    "assets",
    "favicon.ico",
    "styles.css",
    "d3.js",
],

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM