我正在使用ng-cli
构建工具来组装我的Angular2应用程序。
我正在使用Sass来设计我的组件。在这些sass文件中,我想从bootstrap中导入一些sass内容。
我通过使用Sass @import
使用node_modules
下面相关引导程序文件的相对路径来实现此目的:
@import "../../../../node_modules/bootstrap/scss/_variables.scss";
这有点麻烦,如果我更改组件的目录结构会中断。
是否有更简洁的机制导入node_modules
形式而没有相对路径?
似乎sass属性includePaths
允许我将node_modules
声明为包含路径,并允许我进行简洁的导入
@import "bootstrap/scss/_variables.scss";
如何指示ng-cli
使用includePaths
配置Sass?
答案 0 :(得分:0)
尝试添加@import" ~bootstrap / scss / _variables.scss"在你的styles.scss
中