我正在尝试角色,并尝试在项目中获得sass和bootstrap.我在
wiki读过,你可以简单地做:
ng install sass
用最新的(beta.5)进行此操作会给我一个错误:
Install Failed. Could not find addon with name: sass
解决方法
NOTE: This answer is out of date due to changes in the Angular CLI,please refer to the answer below from Woot which is more current.
您需要通过npm i node-sass –save-dev安装node-sass,然后将angular-cli.json中的styleExt更改为sass或scss(或者您可以通过ng set defaults.styleExt scss
至于引导,将它放在公共目录下(我使用一个名为style的子目录),并在index.html中引用它
更新:@H_301_25@此外,如果您想要有变量文件,您可以将目录添加到这样的angular-cli-build.js …
return new Angular2App(defaults,{ vendorNpmFiles: [ ... ],sassCompiler: { includePaths: [ 'src/app/style' <-- directory for SASS reference files ] } });