2017-10-23 21 views
0

私はangular-cliを使っているプロジェクトを持っています。私はmdc components /を使用しています。個別のコンポーネントのsassファイルをインポートしたいこのため、angular-cliプロジェクトでmdc sassファイルを使用

1)私はstyle.scssにファイルstyle.cssを改名、このコマンド

ng set defaults.styleExt scss 

2)を使用して、デフォルトのstyleExtを変更しました。 angular-cli.json

3))は

"styles": [ 
     "styles.scss" 
     ], 

4に

"styles": [ 
     "styles.css" 
     ], 

を変更パス

"stylePreprocessorOptions": { 
     "includePaths": [ 
      "node_modules" 
     ] 
} 

5を含むようにstylePreprocessorOptions構成を追加した)最後style.scssファイルに

01をインポートは
@import '[email protected]/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 

を示している、私は何かが足りないのですか?

答えて

0

node_modulesの代わりにincludePathに間違いがありました。../node_modulesである必要があります。

"stylePreprocessorOptions": { 
     "includePaths": [ 
      "../node_modules" 
     ] 
} 

変更後、正常に動作しています。

関連する問題