docs-v7
docs-v7 copied to clipboard
Documentation doesn't mention need to manually change schematics to properly generate angular components
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-componentto generate*.cssfiles instead of*.scssfiles. - In order to have the new components properly generated you need to change the schematics for new nativescript components on
angular.jsonlike 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.
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.
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