You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Have ng g c [name] generate inline-template and inline-style automatically from config #6570
ng new delete-me-quickly cd delete-me-quickly/src/app ng g c hello cd hello && ls
Contains html and css files, instead of them being inline.
The log given by the failure.
Desired functionality.
If the functionality is specified in ng new using -is or -it, a respective setting should be saved in .angular-cli.json and stick in generation of new Components and/or Directives.
Mention any other details that might be useful.
I came up with it during research I'm doing for #6480, where I'm updating the documentation for ng new.
I would like to further contribute by adding this feature myself and PRing it. Would that be acceptable? Is this feature even discussed? I would very much like to contribute in the cli, especially something that is more code than docs.
EDIT
After additional research, I did find that .angular-cli.json has such configuration, as specified here:
changed the title [-]Have ng g c [name] generate inline-template and inline-style[/-][+]Have ng g c [name] generate inline-template and inline-style automatically from config[/+]on Jun 3, 2017
@filipesilva@Brocco It's good option to have on the other side I think it should be on the component also as when creating small components which only are containers or have few lines would like to have those inline.
@sumitarora what you're talking about exists. My thought process behind this change is that if someone specifies in lines on new, I believe they want it for the entire app. If someone wants a particular component with inlines, the g c command accepts inlines already, and they are given priority over defaults, as you can see in the snippet above
To understand, you wish to make the change that when a user creates an app using --inline-template or --inline-style that the setting be persisted to .angular-cli.json for future generations for that app?
Current state, just the app component will get inlined, no setting saved to .angular-cli.json
Proposed: set the inline flag(s) when used during ng new
Issue: What if the dev wants to only inline their app component as it typically is very light but not all subsequent components?
Suggestion: Add new flags to clearly state the desire to have all components inlined...
@Brocco I like the suggestion. Also I think that the existing flags documentation should be updated to explain they only cause AppComponent to be inline.
Reacted by Mike Brocchi, Sumit Arora and Mike Pearson
@filipesilva@sumitarora@Brocco So it's agreed that -all is the right way to go? Can I go on and implement? Implementation would be an update to my existing PR #6571
@Brocco, @gioragutt I just gave some thoughts and in my opinion a good "logic" soluton would be:
1- When creating a new project, a setting wiil be saved to .angular-cli.jsony
2- This setting can be changed anytime by the dev in ng set defaults.inline="true/false"
3- when the dev generates a component, pipe, etc.. the cli will generate according to the defaults inline unless he specifies otherwisse with the current "-is" flag or with one new flag to be created "-nis" no inline.
4- If the dev specifies the "-is" or "-nis" this configuration will override the defaults but only for this component/pipe, etc.
@ampgular this is how it works today. Except that it just doesn't save it in .angular-cli.json, which is what my PR changes. You can see in the generate command, that it checks both the setting in .angular-cli.json, and the setting from the command line arguments given in the command, giving priority to the command line argument setting.
Activity
[-]Have ng g c [name] generate inline-template and inline-style[/-][+]Have ng g c [name] generate inline-template and inline-style automatically from config[/+]filipesilva commentedon Jun 6, 2017
@Brocco WDYT?
sumitarora commentedon Jun 6, 2017
@filipesilva @Brocco It's good option to have on the other side I think it should be on the component also as when creating small components which only are containers or have few lines would like to have those inline.
gioragutt commentedon Jun 6, 2017
@sumitarora what you're talking about exists. My thought process behind this change is that if someone specifies in lines on
new, I believe they want it for the entire app. If someone wants a particular component with inlines, theg ccommand accepts inlines already, and they are given priority over defaults, as you can see in the snippet aboveBrocco commentedon Jun 6, 2017
To understand, you wish to make the change that when a user creates an app using
--inline-templateor--inline-stylethat the setting be persisted to.angular-cli.jsonfor future generations for that app?Current state, just the app component will get inlined, no setting saved to
.angular-cli.jsonProposed: set the inline flag(s) when used during
ng newIssue: What if the dev wants to only inline their app component as it typically is very light but not all subsequent components?
Suggestion: Add new flags to clearly state the desire to have all components inlined...
The result of using these flags would be to set it for the current run and set the value in
angular-cli.jsonThoughts?
gioragutt commentedon Jun 6, 2017
@Brocco I like the suggestion. Also I think that the existing flags documentation should be updated to explain they only cause AppComponent to be inline.
gioragutt commentedon Jun 10, 2017
@filipesilva @sumitarora @Brocco So it's agreed that
-allis the right way to go? Can I go on and implement? Implementation would be an update to my existing PR #6571donoso-eth commentedon Jul 28, 2017
@Brocco, @gioragutt I just gave some thoughts and in my opinion a good "logic" soluton would be:
1- When creating a new project, a setting wiil be saved to .angular-cli.jsony
2- This setting can be changed anytime by the dev in ng set defaults.inline="true/false"
3- when the dev generates a component, pipe, etc.. the cli will generate according to the defaults inline unless he specifies otherwisse with the current "-is" flag or with one new flag to be created "-nis" no inline.
4- If the dev specifies the "-is" or "-nis" this configuration will override the defaults but only for this component/pipe, etc.
What do you think?
gioragutt commentedon Jul 28, 2017
@ampgular this is how it works today. Except that it just doesn't save it in
.angular-cli.json, which is what my PR changes. You can see in thegeneratecommand, that it checks both the setting in.angular-cli.json, and the setting from the command line arguments given in the command, giving priority to the command line argument setting.phamdt commentedon Sep 7, 2017
+1
angular-automatic-lock-bot commentedon Sep 7, 2019
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.