-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): add fallback for CSS variables #7770
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
Conversation
Add postcss-custom-properties module to provide backwards-compatible support for "var" keyword in CSS files. Working towards resolving #7514.
Add postcss-custom-properties module the @angular/cli package template. Include postcss-custom-properties in the style pipeline. Working towards resolving #7514.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think this is a good fix. Thanks!
Aim to resolve #7514 by including postcss-custom-properties. This will generate extra rules in CSS when a `var()` is used to allow for compatibility with older IE browsers that do not support the feature.
@garoyeri Is this supposed to work everywhere in the app ? Because currently it seems to work for CSS variables declared and used in the global styles ( |
Reading through https://github.com/postcss/postcss-custom-properties/blob/master/README.md, there are some caveats on what works and what doesn't. Primarily, it will only work on variables declared in the |
@garoyeri Yes my variables are in |
Ok, I did a little more digging, turns out that it is completely unsupported by postcss-custom-properties as per the issue here: postcss/postcss-custom-properties#68. Basically, the plugin only operates on a single file unless you use postcss-import to inline the other styles which may cause weird things to happen. The only thing I can think of off the top of my head is to create a theme stylesheet globally that will be used by the component to map your theme variables onto the specific styles you want to override. This definitely isn't ideal, and supporting IE11 is an uphill journey :( |
Aim to resolve angular#7514 by including postcss-custom-properties. This will generate extra rules in CSS when a `var()` is used to allow for compatibility with older IE browsers that do not support the feature.
@cyrilletuzi I'm stubling upon the same issue where component styles are not using the values generated by postcss-custom-properties. Do you have a workaround for this? |
@nicky-lenaers This feature has been removed from the CLI, because the issue couldn't be solved. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Aim to resolve #7514 by including postcss-custom-properties. This will generate extra rules in CSS when a
var()
is used to allow for compatibility with older IE browsers that do not support the feature.