docs-v7 icon indicating copy to clipboard operation
docs-v7 copied to clipboard

Documentation doesn't mention need to manually change schematics to properly generate angular components

Open gbrunow opened this issue 6 years ago • 2 comments

Make sure to check the existing issues in this repository

Please, tell us what's the problem?

[ ] A typo [ ] Wrong documentation [x] Improvement of existing article [ ] Missing documentation [x] New article needed

Please, tell us more details

  • After enabling sass the schematics for new angular components are not automatically set causing ng g c some-component to generate *.css files instead of *.scss files.
  • In order to have the new components properly generated you need to change the schematics for new nativescript components on angular.json like so:
"schematics": {
  "@nativescript/schematics:component": {
    "styleext": "scss"
  }
}
  • This seems to not be mentioned in the documentation
  • Moreover I couldn't find a way of setting this through the CLI.

gbrunow avatar Mar 12 '19 03:03 gbrunow

You can run (it is documented in Angular CLI docs):

ng config schematics.@schematics/angular:component.styleext scss

the changes are reflected in angular.json file, but unfortunately it doesn't take effect and generating new component still creates css files instead of scss.

armpogart avatar Apr 13 '19 15:04 armpogart

I have just noticed that you mentioned in your issue how to set default styles extensions for @nativescript/schematics and it turns out that ng g c some-component uses that schematic instead of angular one. I would propose to document also setting it through command line by running:

ng config schematics.@nativescript/schematics:component.styleext scss

armpogart avatar Apr 13 '19 15:04 armpogart