angular - How to add Sass support to webpack-angular2 starter kit? -
i using webpack-angular2 starter kit (https://github.com/angularclass/angular2-webpack-starter)
how can implement sass support?
after research implemented sass support.
this solution:
command line inside project folder existing package.json is:
npm install node-sass sass-loader raw-loader --save-dev
in webpack.common.js, search "loaders:" , add object end of loaders array (don't forget add comma end of previous object):
{ test: /\.scss$/, exclude: /node_modules/, loaders: ['raw-loader', 'sass-loader'] // sass-loader not scss-loader }
then in component:
@component({ styleurls: ['./filename.scss'], })
if want global css support on top level component (likely app.component.ts) remove encapsulation , include scss:
import {viewencapsulation} '@angular/core'; @component({ selector: 'app', styleurls: ['./bootstrap.scss'], encapsulation: viewencapsulation.none, template: `` }) class app {}
Comments
Post a Comment