postcss / postcss-color-function

PostCSS plugin to transform W3C CSS color function to more compatible CSS
MIT License
323 stars 31 forks source link

Unanable to use with custom properties #42

Closed yepninja closed 6 years ago

yepninja commented 6 years ago

The plugins fails on custom property as color to transform:

.foo {
     color: color(var(--color) a(.5));
}

It is possible to solve problem to use postcss-custom-properties before postcss-color-fucntion. But it is not good variant if custom properties are used in production. Also it is a problem when using cssnext with browserslist for modern browsers. It doesn't transform custom properties, but try to transform color function, what cause error.

TrySound commented 6 years ago

This plugin is not able to process your runtime. It's just simple static converter. If you want flexible color processing with css custom properties, use javascript libraries.

yepninja commented 6 years ago

I understand that it is just static converter. But this problem can be solved, if user would transform custom properties before using color function. Mostly I talk about problem in cssnext. I think it better to write issue for cssnext. But in postcss-color-function would be useful to improve UX and process such errors

Semigradsky commented 6 years ago

I see that it was fixed in https://github.com/postcss/postcss-color-function/pull/36