Angular-cli: 6.0.0-beta.8 ignores inline style & template, along with scss config.

Created on 29 Mar 2018  路  8Comments  路  Source: angular/angular-cli

Versions

Angular CLI: 6.0.0-beta.8
Node: 9.9.0
OS: win32 x64

Repro steps

ng new test-app --routing -it -is -si --style=scss' <- this generates properly ng g c test`

Observed behavior

CREATE projects/pizza-client/src/app/test/test.component.html (23 bytes)
CREATE projects/pizza-client/src/app/test/test.component.spec.ts (614 bytes)
CREATE projects/pizza-client/src/app/test/test.component.ts (257 bytes)
CREATE projects/pizza-client/src/app/test/test.component.css (0 bytes)
UPDATE projects/pizza-client/src/app/app.module.ts (467 bytes)

Desired behavior

CREATE projects/pizza-client/src/app/test/test.component.spec.ts (614 bytes)
CREATE projects/pizza-client/src/app/test/test.component.ts (257 bytes)
UPDATE projects/pizza-client/src/app/app.module.ts (467 bytes)

Mention any other details that might be useful (optional)

I would assume other configurations are affected, such has --module=something or --minimal /--skip-tests

This appears to have broken from the migration from angular-cli.json to the new angular.json,
there is no defaults section

Most helpful comment

I've found a workaround while waiting for the angular team to fix this. At the end of your angular.json file, right before the last closing bracket, add the following :

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

Save your angular.json file and try to create a new component, it should now generate scss file.

All 8 comments

I've also it that issue with SCSS not being taken into account when using ng g c WhateverComponentName.

Is this something we missed when migrating from the old CLI config file to the new one?

On a newly-created project, I haven't found any way to ensure that new components are created with SCSS styles. Even if the project is created using --style=scss it makes no difference. It seems like support for setting the default styleExt within the project is completely missing!

The RC3 version didn't fix it either.

I tried --style=sass and --prefix=myprfx, none of them work. Style applied only for the main styles file and for the 'app.component', not for new generated ones.

I am surprised that nobody has fixed it since like beta 5 or so...

RC4 is out, not yet fixed, neither when creating a new project with --styles=scss.

I've found a workaround while waiting for the angular team to fix this. At the end of your angular.json file, right before the last closing bracket, add the following :

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

Save your angular.json file and try to create a new component, it should now generate scss file.

RC5 fixed it. It's now working properly when doing ng new AppTest --style=scss.

This can now probably be closed.

This is already fixed by angular/devkit#666, released in RC5.

But there is an issue with options with an uppercase letter: #10371

Was this page helpful?
0 / 5 - 0 ratings