Skip to content

Compile inline styles to the identified style format (SCSS, LESS, etc) #8470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
johnpapa opened this issue Nov 13, 2017 · 5 comments
Closed

Comments

@johnpapa
Copy link
Contributor

Bug Report or Feature Request (mark with an x)

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

Versions.

Angular CLI: 1.5.0
Node: 8.9.1
OS: darwin x64
macOS Sierra 10.12.6

Repro steps.

  1. run ng new foo --styles scss
  2. create a component with inline styles
  3. add scss styles to it
  4. run ng serve -o

The log given by the failure.

The style compile as CSS, even though we set them to be SCSS in the cli json file

Desired functionality.

I would like to see angular transpile inline styles and external files styles using the identified selection.

Mention any other details that might be useful.

The workaround is to move styles for SCSS to their own file, using the styleUrls metadata.

@hansl
Copy link
Contributor

hansl commented Nov 13, 2017

Hi @johnpapa,

Inline styles will not be rendered with a special renderer, unfortunately. It is impossible for us to know which compiler you want your inline style to use, and even so we don't have control over how inline styles are compiled; we do not resolve their content like we do with external styles. This is a limitation of the angular compiler itself.

I'm going to close this as working as intended.

Cheers!

@hansl hansl closed this as completed Nov 13, 2017
@johnpapa
Copy link
Contributor Author

I do not understand ... if the CLI knows it is SASS (aka scss), then how do we not know what to tell the compiler?

How are external file templates different? Is it because SASS just hits those extensions by default and the webpack compiler for sass, less, etc are always there?

@filipesilva
Copy link
Contributor

FYI there was a PR to do this (#8145).

@hansl
Copy link
Contributor

hansl commented Nov 30, 2017

if the CLI knows it is SASS (aka scss)

We do by the file extension. For inline styles we don't. The PR referred by Filipe is a hack that creates fake files and refactor the component.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants