Reputation: 16157
Prior to updating to Angular 9, my project was configured to use SCSS when the ng generate
command was run, and indeed it did.
Much to my dismay, after running my first ng g c
on Angular 9, it added a css
file rather than a scss
file.
The accepted answer to this does not appear to work any longer. My angular.json
includes the following (as it has for the past two years):
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
How do I fix this?
Upvotes: 8
Views: 4495
Reputation: 2331
I recently upgraded my Angular CLI to v12 and generated a new project. I opted to generate scss files for new components. After creating a component, I saw that css files were being generated, not scss files. I ran the below command and now when I generate a new component, the scss file is created and not css.
ng config schematics.@schematics/angular:component.style scss
Upvotes: 8
Reputation: 2363
Please try like this.
In angular.json, set "schematics" as below to default scss when generate new component
"schematics": { "@schematics/angular:component": { "style": "scss" } }
Upvotes: 14