Generate(component): Does not default to SCSS when specified in `.angular-cli.json`
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.4.0 node: 8.4.0 os: darwin x64 @angular/animations: 4.4.0-RC.0 @angular/cdk: 2.0.0-beta.8 @angular/common: 4.4.0-RC.0 @angular/compiler: 4.4.0-RC.0 @angular/core: 4.4.0-RC.0 @angular/flex-layout: 2.0.0-beta.9 @angular/forms: 4.4.0-RC.0 @angular/http: 4.4.0-RC.0 @angular/material: 2.0.0-beta.8 @angular/platform-browser: 4.4.0-RC.0 @angular/platform-browser-dynamic: 4.4.0-RC.0 @angular/router: 4.4.0-RC.0 @angular/cli: 1.4.0 @angular/compiler-cli: 4.4.0-RC.0 @angular/language-service: 4.4.0-RC.0 @angular/service-worker: 1.0.0-beta.16 typescript: 2.5.2
Repro steps.
Run ng g c foo
The log given by the failure.
No failure
Desired functionality.
Result: foo.component.css
Expected Result: foo.component.scss
Mention any other details that might be useful.
.angular-cli.json Example:
"defaults": {
"styleExt": "scss",
},
I face same problem
You can use flag ng g c foo --style=scss
You can use flag
ng g c foo --style=scss
But why is not documented?
https://github.com/angular/angular-cli/blob/master/docs/documentation/generate/component.md
And why styleExt: scss doesn't work?
I also just noticed that my specified default "prefix" is not working either.
@lubkoKuzenko You are correct, the individual flags still work but this bug report is for the .angular-cli.json file defaults not working.
I just faced the same problem. It was working with 1.3.2.
It should supposed to be fixed in #7430, but the problem persists.
Experiencing this with 1.4.1 as well.
Seeing this with 1.4.1 as well. Cheers.
I see that the app prefix is now being generated in v1.4.2 via bc58afe #7522 but the styleExt default is still not working.
Same problem with 1.4.2
I have the same problem with 6.0.0-rc.3
Same problem with 6.0.3
Same problem with 6.0.2
Same problem with 6.0.1 .
My solution was to use the styleext command line argument when generating a component:
ng generate component dir/component-name --project=my-project --styleext=scss
A bunch of other links said to use a style command argument, but that didn't work for me, I assume because the argument changed when it finally got documented, or as part of the move from .angular-cli.json to angular.json.
"schematics": { "@schematics/angular:component": { "spec": false, "styleext": "scss" }, instead of "schematics": { "@schematics/angular:component": { "spec": false, "styleExt": "scss" }
Maybe I'm wrong. But I do not understand why this bug is closed. It definitely does not work in the latest version (Angular CLI 6.0.3).
Agreed, I am having the same issue with Angular 6.
I'm also having this issue: node: 10.8.0 npm: 6.2.0 angular: 6.0.2 angular/[email protected]
Also having this issue on Angular 6. ng g c test-component --style=scss also doesn't work.
@Jrb1x Use --styleext=scss instead of --style=scss,
Same issue on a totally new project.
I use "ng new my-app --style=scss" and it's works (generate styles.scss for exemple), but "ng g c my-component" generate an .css