[英]Bootstrap framework not included in the angular-cli
我已經通過npm安裝了bootstrap框架到angular2項目,它顯示在node-modules文件夾中。但是,angular-cli文件沒有boosts腳本以及css。
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
我手動嘗試將bootstrap位置css,js文件添加到angular-cli文件中,然后重新啟動,但顯示生成錯誤。是否有其他解決方案可解決此問題?
此處的Angular CLI文檔中有說明: https : //github.com/angular/angular-cli/wiki/stories-include-bootstrap
您需要在styles
數組中添加css文件,如下所示:
"styles": ["styles.css", "../node_modules/bootstrap/dist/css/bootstrap.css"]
如果您需要bootstrap js文件,則可以如下添加它:
"scripts": ["../node_modules/bootstrap/dist/js/bootstrap.min.js"]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.