-
Notifications
You must be signed in to change notification settings - Fork 77
var(...)
is not recognized or parsed when used after CSS Modules @value
#39
Comments
This plugins aims to allows a futur proof code according to W3C specs. |
So no intention of parsing the CSS Modules Values syntax? Well, that's good to know because it basically means one shouldn't try to use this plugin in combination with CSS Modules. |
Why do you want to use this AND duplicate some var with css modules values? |
I totally understand why css modules have a way to declare variables, but how is it a good idea to use both css modules values and this plugin? |
Good question :) I think everybody is still very much trying to figure these new ideas out. Currently, Values are fairly limited in the sense that they cannot be easily used to pass values into a preprocessor function (such as postcss-color-function), because they are parsed and resolved after the preprocessor do their job (using webpack's That is clearly not ideal and is bound to change (I guess), but for now the best we can do is use preprocessed variables locally (within a Module) and create all the exports (Values) from them. |
@timmolendijk I also ran into the same problem. I am using the |
I see that a PR to fix this @value+other-postcss-plugins conundrum issue was made, and rejected: webpack-contrib/css-loader#263. There is another postcss plugin which claims to fix this though: https://github.com/princed/postcss-modules-values-replace |
I’m open to a PR for functionality or something in the README, and closing this issue as it is not (yet) a supported feature. |
As far as I understand, CSS Modules Values syntax is designed to not break CSS.
Its main syntax (to define a value) is
@value my-color: #ff0000;
or@value my-color: #ff0000;
. The idea is that variables can be preprocessed into these value definitions, as follows:In this example
postcss-custom-properties
fails to recognize and parse thevar(--my-red)
.The text was updated successfully, but these errors were encountered: