angular.js - Problem extracting sass files under ng2?
天蓬老师
天蓬老师 2017-05-15 17:09:52
0
1
609

1. Components:

import { Component } from '@angular/core';

@Component({
    selector: 'app',
    template: require('./app.component.html'),
    styles: [ require('./app.component.scss') ]
})
export default class AppComponent{

}

2. Configuration in webpack:

...
{
    test: /\.scss$/,
    loader: ExtractTextPlugin.extract( 'style-loader', 'raw-loader!css-loader!sass-loader' ),
    exclude: /node_modules/
}
...

3. Report in the browser Uncaught Error: Expected 'styles' to be an array of strings.

4. How to extract scss files?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
漂亮男人

Please use styleUrls, raw-loader should be executed last. However, if you need to AOT compile after using require, you will be in trouble.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template