feat(@schematics/angular): add 'none' value for the 'style' option of the component schematic #21141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow setting
--style=none
for the component schematic to prevent generation of any style file. Previously this was possible only with--inlineStyle=true
, which had the side-effect of adding an inline style block to the component decorator. Useful for components or projects which have entirely externalised stylesheets and never want to use component-specific styles.Motivation
In our project we have an externally-managed SCSS project to allow our customers theming flexibility. As such our components only use the BEM classes from this project. Almost none of our components contain any actual CSS.
Every time we run
ng g c ...
we have to then manually delete the style file or style block from the component decorator in the generated .component.ts file, which is a little tedious. This PR will allow us to setnone
as the default value for thestyles
option for the component schematic in our angular.json, giving us a nice little productivity and quality-of-life boost. :)