Is there such an option to create a Module that is linked to a component, which does not have a css file upon creation?
e.g.
The default way of doing this for me so far is the following:
ng generate module name
/
ng generate component name
And I get the basic structure of a component:
name.component.css
name.component.html
name.component.spec.ts
name.component.ts
name.module.ts
And I want to create the following with only ONE query:
name.component.html
name.component.spec.ts
name.component.ts
name.module.ts
e.g. something like:
ng g m name + c name - css
... you get the idea.
Is this possible, and if yes, how?
You have to use "--skip-tests true" when generating component. (Note: you can get the above version info by trying "ng v" or "ng -v" in the terminal). You can get the complete list of switches for "ng g c (short for ng generate component)" using "ng g c --help". Alternatively you can add a component manually.
Getting Started With Angular 7 Once you have the angular cli installed, use the ng cli command to create a new Angular project.
We can use CSS Modules with Angular through postcss-modules and posthtml-css-modules.
Minimalist Angular Cli generate example
ng g c hero-component --flat -it -is --skipTests
-is
for inline css, preventing style file creation--flat
to prevent folder creation-it
for inline template, preventing html file creation--skipTests
to prevent .spec file creationLink to the Angular doc reference https://angular.io/cli/generate#component
With all these parameters together,
The cli creates a single .ts file in the current folder and links it in the module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With