-
Notifications
You must be signed in to change notification settings - Fork 813
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
Improve CSS Variable Support in Additional CSS #19669
Comments
Related: #1874 |
This could also be an issue for dealing with experimental link color support in Gutenberg (which currently appears to use CSS variables for the color). |
26011821-hc I couldn't use |
It looks like CSSTidy has been forked/continued on github: Cerdic/CSSTidy, and they've recently added custom properties support. I think the Jetpack version has diverged, so it's probably not a drop-in replacement, but maybe that fix could be ported over? |
@ryelle We just came across that ourselves (Cerdic/CSSTidy). We'll have to do some exploration of versions too since the latest version doesn't support PHP 5.6 (which we do), but the last version that does support 5.6 may be throwing warnings/issues in PHP 8/8.1, etc. My hope is that we can utilize it wholesale so we don't have to maintain a fork, 🤞🏼 |
Is your feature request related to a problem? Please describe.
Right now, when CSS is added to the Additional CSS section of the Customizer, it seems we're using CSSTidy to parse/optimize it etc. However, CSSTidy strips out the formatting necessary for CSS variables to work and otherwise valid CSS variables are not applied.
Describe the solution you'd like
Adjust the CSSTidy formatting behavior to add support for CSS variables.
Describe alternatives you've considered
Anything set with a CSS variable can certainly be set directly without it by using the right selector etc. However, with more and more themes using variables, along with Gutenberg etc., having the ability to quickly and easily adjust variables in the Customizer would be really rad. It'd also make theme customizations much cleaner and faster when compared to manually specifying a color (for instance) for every element that uses it.
Additional context
This came up because I was attempting to customize the colors for a theme that sets almost everything via CSS variables. I reached out via Slack p1619535922496400-slack-C010KDAPG49 and chatted with @annemirasol and @mirka about the issue, and was made aware of the fact that it might be related to CSSTidy and formatting set through it: https://github.com/Automattic/jetpack/blob/master/projects/plugins/jetpack/modules/custom-css/custom-css.php#L279 https://github.com/Automattic/jetpack/blob/master/projects/plugins/jetpack/modules/custom-css/custom-css.php#L1630
Also, with some additional digging, it seems like CSS Tidy isn't being actively maintained as a project anymore (see changelog), so if modifying/updating it doesn't make the most sense, perhaps there's a more up-to-date alternative (that supports CSS variables) that could be used instead?
The text was updated successfully, but these errors were encountered: