postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
597 stars 77 forks source link

html custom properties with preserve: false #142

Closed jzempel closed 5 years ago

jzempel commented 5 years ago

With v8.0.0 support for custom properties declared within html rules, we lost the ability to reference variables under html with preserve: false. Given the following:

:root {
  --html-background-color
}

html {
  background-color: var(--html-background-color);
}

After postcss (with preserve: false):

html {
  background-color: var(--html-background-color);
}

Is there a workaround available? Here's the actual source file we are attempting to process: https://github.com/zendeskgarden/css-components/blob/master/packages/bedrock/src/_base.css. All custom properties under the html selector are not being resolved like they were prior to v8.0.0.

jonathantneal commented 5 years ago

Great catch, @jzempel. I’m sorry you had to find the bug, but it’s been resolved in 8.0.6. 🎉

jzempel commented 5 years ago

We'll keep :eyes: out for when you roll that patch into https://github.com/csstools/postcss-preset-env. Thanks!

jonathantneal commented 5 years ago

Of course. It has shipped in 6.0.7.