GoogleChromeLabs / postcss-jit-props

A CSS custom property helper based on PostCSS. Supply a pool of variables and this plugin will add them to the stylesheet as they are used.
https://stackblitz.com/edit/jit-open-props?file=postcss.config.js
Apache License 2.0
210 stars 9 forks source link

Bug: Nested properties are purged if the first prop is not defined #18

Closed benbender closed 2 years ago

benbender commented 2 years ago

I'm using "nested" props to encapsulate properties in components while having the ability of global defaults at the same time (in-depth explanation here)

Anyway, the following syntax isn't picked up:

border-radius: var(--button-radius, var(--radius, 0.25em));

--button-radius isn't defined, but --radius is. --radius gets purged by the lib... 😢 If I remove the nesting, --radius is picked up.

benbender commented 2 years ago

Turns out the problem isn't the nesting, but the undefined, first prop which led to skipping of the later ones. Fix + test in #19.