Feature: support command-line args for templates and stylesheets
It would be nice to have some command line parameters for ng g my-component. E.g. to specify if a separate .html-file should should be created or maybe inline-HTML is enough.
Here some suggestions:
ng g component my-component arg
| arg | description |
|---|---|
--template |
use template: 'my-component works' instead of templateUrl: 'path/to/file.html' |
--styles |
use styles: [] instead of styleUrls: ['path/to/file.css'] |
--no-style |
no styles: [] or styleUrls: ['path/to/file.css'] in the component |
I believe the build process is going to eventually take the URL's and replace them with the inlined content from the files. @hansl am I remembering right?
I like this idea, except for the usability aspect. I don't like the idea of having to specify these arguments with every generated component (for consistency in an application).
I think settings like this can be handled in 2 ways.
- Add settings through the settings file
angular-cli.json - A component style add-on
At this point neither are fully ready for use, but I think at this time the CLI would be best served by waiting for one of those two mechanisms to be in place rather than requiring developers to supply the flags every time a component was generated.
I like settings things in the angular-cli.json works well but I still think there should be provided command line args to overwrite those if needed for a one off.
I agree with @deebloo .
Configure this globally in angular-cli.json makes sense (e.g. if I want to use template instead of templateUrl in my whole project).
But in some cases (e.g. if the template contains only <router-outlet></router-outlet> I may just want to use the inline-template in one of many components.
Late to this, but... Using the "--it" and "--is" flags accomplish this goal.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.