MadLittleMods / postcss-css-variables

PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation
https://madlittlemods.github.io/postcss-css-variables/playground/
Other
536 stars 62 forks source link

Breaks `linear-gradient` value list #35

Open tlindig opened 8 years ago

tlindig commented 8 years ago

following results in unexpected code:

textarea {
  background-image: linear-gradient(var(--primary-color, #ff5722), var(--primary-color, #ffff22));
}

results in:

textarea {
  background-image: linear-gradient(#ff5722), var(--primary-color, #ffff22);
}

but should:

textarea {
  background-image: linear-gradient(#ff5722, #ffff22);
}

tested also with playground

MadLittleMods commented 8 years ago

:+1: Thanks for the report. It looks like the fallbacks are messing with things.

For now you can work around it like this:

.foo {
    --gradient-color1: var(--primary-color, #ff5722);
    --gradient-color2: var(--primary-color, #ffff22);
    background-image: linear-gradient(var(--gradient-color1), var(--gradient-color2));
}

Feel free to make a PR :grinning: