-
Notifications
You must be signed in to change notification settings - Fork 12k
add fallback for css variables #7514
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
Comments
There is an option for a separate postcss.config.js and postcss-loader supports it. You can also pass a ctx object, so things like 'only minify production builds' work. Currently the postcss-config is hardwired the webpack config, extracting it into a project-level file would allow users of angular-cli to change the postcss configuration to fit their needs. |
I'm working on PR #7712 to add this feature. I verified that using |
But the tests are not being nice to me... Can someone please take a look at my PR and see if I'm doing something dumb? |
I tried out cssnext, but there are some licenses (Public Domain) that are incompatible with the policies of the Angular CLI project. Instead, I have submitted a new PR #7770 using the postcss-custom-properties module which is much less invasive and much more license-friendly. Let's see how it goes. |
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.
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.
A lot of warnings are being shown to me since these changes:
when I set: :root {
--custom-property: 200;
} on some-css-selector {
--custom-property: 100;
} It's working perfectly fine but it's very annoying seeing a warning for each css variable I override. May that be related to a Edit: Just saw the warnings can be disabled using the |
@Morente5 that's definitely a problem. Can you open a new issue and reference this one there please? We may have to revert the PR that introduced this problem. |
After long time searching I just found the solution: webpack-config {
loader: 'postcss-loader',
options: {
plugins: (loader) => [
cssnext({
features: {
customProperties: {
warnings: false
}
}
})
]
}
} |
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.
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. |
Uh oh!
There was an error while loading. Please reload this page.
Desired functionality.
Css variables should degrade gracefully on older browsers by having a fallback. This post css plugin does exactly that when started with the option
preserve: true
. More generally I believe the cli should support the css cutting edge with fallback thanks tocssnext
. However variables is what this request is about.Why ?
If css variable is not supported by a browser it will simply be ignored, meaning that a bunch of css statements won't be applied.
Example
This
should compile to this:
Here is an example that would do just that:
The text was updated successfully, but these errors were encountered: