如何在Angular2种子项目中实施SCSS。是否有更好的教程或参考网站可以看到这个?
我尝试在此链接中实现相同的功能 https://github.com/AngularClass/angular2-webpack-starter/wiki/How-to-include-SCSS-in-components
但我收到此错误
ERROR in ./src/app/components/subscription/subscription.component.scss
Module parse failed: C:\indiaAbroad\iaApp\src\app\components\subscription\subscription.component.scss Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| .subscription {
|
| }
@ ./src/app/components/subscription/subscription.component.ts 18:21-61
@ ./src/app/config/app.module.ts
@ ./src/main.browser.ts
@ multi main Hash: e76bd7a5a02aa33e1272
答案 0 :(得分:2)
npm install node-sass sass-loader raw-loader --save-dev
在webpack.common.js中,搜索“rules:”
{ test: /\.scss$/, exclude: /node_modules/, loaders: ['raw-loader', 'sass-loader'] // sass-loader not scss-loader }
答案 1 :(得分:2)
你所做的是正确的。
安装后,此软件包重新启动npm服务器。它会工作!!!
答案 2 :(得分:1)