For new projects we can set the options --style=sass
or --style=scss
according to the desired flavor SASS/SCSS
$ ng new project --style=sass
then install node-sass
,
$ npm install node-sass --save-dev
To make angular-cli
to compile sass files with node-sass
, I had to run,
$ npm install node-sass --save-dev
which installs node-sass
. Then
$ ng set defaults.styleExt sass
to set the default styleExt to sass (or) change styleExt
to sass
in angular-cli.json
,
"defaults": {
"styleExt": "sass",
}
Although it generated compiler errors.
ERROR in multi styles
Module not found: Error: Can't resolve '/home/user/projects/project/src/styles.css' in '/home/user/projects/project'
@ multi styles
which was fixed by changing the lines of angular-cli.json
,
"styles": [
"styles.css"
],
to
"styles": [
"styles.sass"
],