angular-cli: 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",
},

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 30
  • Comments: 28 (1 by maintainers)

Most upvoted comments

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

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

@Jrb1x Use --styleext=scss instead of --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?

When I use this one: http://prntscr.com/lt11a8 (I use ngrx also) Problem has been solved

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

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.

Experiencing this with 1.4.1 as well.

Same problem with 1.4.2

Working fine for me on v7.3.8. If you run ng new test1 --style=scss you’ll notice ng g component blah creates with .scss.

Here is the minimum angular.json I found that works:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "myproj": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        }
      }
    }
  },
  "defaultProject": "myproj"
}

Same problem with 6.0.3

I have the same problem with 6.0.0-rc.3

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.

@rynop Thank you so much . The change in the “schematics” in angular.json makes the angular-cli adhere to the rule atleast in angular 8