-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Updating postcss-preset-env from v6.7.1 to v7.X causes postcss-css-variables to error #319
Comments
Hi @nickyblissAviva could you share more about your config? Whether that's the |
This is our postcss processing function that is passed into postcss. Is this what you need?
|
@nickyblissAviva checking this I think you should disable Could you try with this?
|
Thank you. I wonder if thats is something that has been left in from when we first setup our CSS pipelines a number of years ago. Good news is I have no errors streaming up my terminal window now, so fingers crossed all is fine. I'll have to do a good chunk of testing to make sure the css coming out is still ok. |
I'm crossing my fingers as well! 🤞 Let us know if you find anything that's not working as expected! |
Looks like there are some differences in the css file outputs. So original output was:
now its:
Now in our original css file with the css variables in the css is formatted with all 4 rules together so these are now being split apart when being run through postcss. Any ideas? |
@nickyblissAviva can you provide the source CSS? |
Stripped right back for you but basically how it all hangs together. variables-icons-core.css
o-faq-panel.css
help.css
|
@nickyblissAviva unfortunately this is happening due to :root {
--icon-arrow-up: url('../images/icons/sprites/arrow-up.svg');
}
.js-o-faq-panel .is-open .o-faq-panel-item__question button:before,
.t-accent-light .js-o-faq-panel .is-open .o-faq-panel-item__question button:before,
.t-accent-dark .t-accent-light .js-o-faq-panel .is-open .o-faq-panel-item__question button:before,
.t-card-accent-light .m-card .js-o-faq-panel .is-open .o-faq-panel-item__question button:before {
background-image: var(--icon-arrow-up);
} With this config: const cssVariables = require('postcss-css-variables');
module.exports = {
plugins: [
cssVariables()
]
}; And I get this behavior. Running with |
@nickyblissAviva forgot to add, you can test yourself here: https://madlittlemods.github.io/postcss-css-variables/playground/ (just found they have a playground) |
Thanks. Looks like this is a "feature" of post-css-variables. Not sure why it suddenly uncovered during the upgrade but looks like we can either swap to the sister package postcss-custom-properties or use a cssnano option to remove to duplication (cssnano option looks a bit dangerous to use). |
We are currently using postcss-preset-env 6.7.1 with postcss 8.4.12, postcss-css-variables 0.18.0 and postcss-import 14.1.0 and when we have tried to update out packages to use the latest version of postcss-preset-env out build scripts start to throw errors for variables being undefined and used without a fallback.
Our current css processing pipeline has a core css file that contains only css imports to our various CSS component files. The first imports in the file contain all the css variables used within the other imported css files.
On moving to any v7 version of postcss-preset-env the variables are no longer being found and replaced within the other imported css files as they were originally.
The text was updated successfully, but these errors were encountered: