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

"undefined" cross-file when using postcss-loader #29

Closed tj closed 8 years ago

tj commented 8 years ago

Specifically I'm using rucksack and postcss-loader in Webpack. :root vars in the same file seem to work fine but otherwise the references just output undefined, any suggestions? They work fine if I assign them in JS. thanks!

MadLittleMods commented 8 years ago

@tj If webpack's postcss-loader is compiling each file separately then we can't see those variables. Can you import the files that contain the variables? https://github.com/postcss/postcss-loader#integration-with-postcss-import

Are other plugins sharing state between subsequent runs?

In my typical setup, I run postcss-import first so that everything is available, then all the other plugins including postcss-css-variables. But I haven't worked with a individually module'd build to hit this before.

tj commented 8 years ago

hmm I'll check that out, webpack is pretty damn confusing haha, sounds like it's not an issue here though thanks for the pointer!

shinzui commented 7 years ago

@tj did you figure out how to make it work?