angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Generate(component): Does not default to SCSS when specified in `.angular-cli.json`

Open timdoes opened this issue 9 years ago • 28 comments

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",
},

timdoes avatar Sep 08 '17 00:09 timdoes

I face same problem

tieppt avatar Sep 08 '17 03:09 tieppt

You can use flag ng g c foo --style=scss

lubkoKuzenko avatar Sep 08 '17 08:09 lubkoKuzenko

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?

frizar avatar Sep 08 '17 11:09 frizar

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.

timdoes avatar Sep 08 '17 19:09 timdoes

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.

rafaelss95 avatar Sep 09 '17 17:09 rafaelss95

Experiencing this with 1.4.1 as well.

zackarychapple avatar Sep 10 '17 20:09 zackarychapple

Seeing this with 1.4.1 as well. Cheers.

bjornharvold avatar Sep 13 '17 07:09 bjornharvold

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.

timdoes avatar Sep 14 '17 01:09 timdoes

Same problem with 1.4.2

marekdon avatar Sep 19 '17 22:09 marekdon

I have the same problem with 6.0.0-rc.3

garysui avatar Apr 12 '18 16:04 garysui

Same problem with 6.0.3

SvenBudak avatar Jun 09 '18 21:06 SvenBudak

Same problem with 6.0.2

LuizAsFight avatar Jun 19 '18 11:06 LuizAsFight

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.

Reboog711 avatar Jun 27 '18 20:06 Reboog711

"schematics": { "@schematics/angular:component": { "spec": false, "styleext": "scss" }, instead of "schematics": { "@schematics/angular:component": { "spec": false, "styleExt": "scss" }

AhmedYousseff avatar Jul 11 '18 09:07 AhmedYousseff

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).

DmitriyIvanko avatar Jul 26 '18 09:07 DmitriyIvanko

Agreed, I am having the same issue with Angular 6.

scott-erdmann avatar Aug 04 '18 21:08 scott-erdmann

I'm also having this issue: node: 10.8.0 npm: 6.2.0 angular: 6.0.2 angular/[email protected]

dc-m avatar Aug 09 '18 15:08 dc-m

Also having this issue on Angular 6. ng g c test-component --style=scss also doesn't work.

Jrb1x avatar Aug 09 '18 19:08 Jrb1x

@Jrb1x Use --styleext=scss instead of --style=scss,

Reboog711 avatar Aug 10 '18 22:08 Reboog711

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

WizardPC avatar Oct 25 '18 15:10 WizardPC