question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Have ng g c [name] generate inline-template and inline-style automatically from config

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request

Versions.

master

Repro steps.

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:

    /* blueprints/component/index.ts */
    options.inlineStyle = options.inlineStyle !== undefined ?
      options.inlineStyle : CliConfig.getValue('defaults.component.inlineStyle');

    options.inlineTemplate = options.inlineTemplate !== undefined ?
      options.inlineTemplate : CliConfig.getValue('defaults.component.inlineTemplate');

But it is not set during ng new.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
gioraguttcommented, 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.

0reactions
angular-automatic-lock-bot[bot]commented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate component with inline template and style using ...
For inline style, we need to add --inlineStyle=true. ... ng generate component <component-name> --inlineTemplate=true --inlineStyle=true.
Read more >
ng generate - Angular
Generates and/or modifies files based on a schematic. ng generate ... This command has the following sub-commands: ... ng generate application [ name...
Read more >
component with inline style & inline template | Angular 13 ...
angularcli #angular13 #nihiratechieesAngular 13 tutorial . this part - 5 explains below the topics1, What is component2, how to create ...
Read more >
Angular Cli support for inline templates and css - Stack Overflow
you can use the cli "ng g c component-name -is -it" to create a component with inline styles and inline template. g -...
Read more >
Angular CLI — — Flags (Cheat Sheet) | by Pardeep Jain
ng g c button --inline-style --inline-template ... If you simply run ng build Angular will create dist folder with files name having hash...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found