Closed MoOx closed 7 years ago
This would be great for when we set preserve: true
on postcss-custom-properties (so that we can progressively enhance). Right now postcss-color-function balks on the preserved rule (with var(--my-color)
) in it.
Ideally, I'd expect the following code:
:root {
--my-color: #567cde;
}
.widget {
background-color: color(var(--my-color) blackness(50%) a(0.9));
}
To get polyfilled to:
:root {
--my-color: #567cde;
}
.widget {
background-color: rgba(87, 98, 128, 0.9);
background-color: color(var(--my-color) blackness(50%) a(0.9));
}
This could be achieved simply by leaving the unprocessable rule alone and carrying on. The first background-color
would get generated by postcss-custom-properties and then transformed by postcss-color-function, the second would be generated by postcss-custom-properties and then ignored by postcss-color-function. Then we can have our cake and eat it too :)
PR welcome :)
Closed by #35 and #36
Ref https://github.com/postcss/postcss/issues/177