0

I want to set the default style extension on my Angular project to scss and whenever new component is created - .scss files to be generated by default. I am using these versions of Angular CLI:

"@angular/cli": "1.7.4",
"@angular/compiler-cli": "5.2.7". 

I've manually set a default styleExt - scss in my .angular-cli.json:

"defaults": {
    "styleExt": "scss",
    "component": {},
    "schematics": {
      "collection": "@nrwl/schematics"
    }
  }

However, when I try to create a new app using the:

ng g app admin  

or

ng g app admin --style=scss

I still get .css files. I've also tried to set the default styleExt to scss by running

ng set defaults.styleExt scss

but that doesn't change anything. It always generates .css files. It seems like the default value is ignored. Any solution?

Christina
  • 361
  • 1
  • 5
  • 17

2 Answers2

0

If you want to set your existing Project css to scss

change your angular-cli.json defaults object like this

"defaults": {
    "schematics": {
      "@schematics/angular:component": {
      "styleext": "scss"
    }

More Info:Angular CLI SASS options

Chellappan வ
  • 23,645
  • 3
  • 29
  • 60
0

If you are using nrwl, you can set the default stylesheet extension by running the following command:

ng config schematics.@nrwl/angular:component.styleext scss

The main reason why you need to do this is, because they moved all the functionality to @nrwl/angular (it was in @nrwl/schematics).

More info about this in the nrwl nx repo

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
bernar
  • 13
  • 1
  • 5