我有一个项目使用angular-cli
. 我正在使用mdc 组件/. 我想导入单个组件的 sass 文件。为了这,
1) 我已经使用这个命令改变了默认的 styleExt
ng set defaults.styleExt scss
2) 将文件重命名style.css
为style.scss
.
3)在angular-cli.json
改变
"styles": [
"styles.css"
],
至
"styles": [
"styles.scss"
],
4)添加stylePreprocessorOptions
配置以包含路径
"stylePreprocessorOptions": {
"includePaths": [
"node_modules"
]
}
5)最后在style.scss
文件中导入
@import '~@material/button/mdc-button';
但这显示
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precis
ion":8,"includePaths":["D://SK//Study//Material//MaterialWithAngularDemo//src//node_modules"]}!./src/styles.scss
Module build failed:
undefined
^
File to import not found or unreadable: @material/theme/mixins.
Parent style sheet: D:/SK/Study/Material/MaterialWithAngularDemo/node_modules/@material/button/mdc-button.scss
in D:\SK\Study\Material\MaterialWithAngularDemo\node_modules\@material\button\mdc-button.scss (line 17, column 1)
@ ./src/styles.scss 4:14-187
@ multi ./src/styles.scss
我错过了什么吗?