postcss/postcss-simple-vars

Error when using a variable in the class name

senya-g opened this issue · 2 comments

ERROR in ./components/button/style/index.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./components/button/style/index.css)
Module build failed (from ./node_modules/css-loader/dist/cjs.js):
Error: Invalid class or id selector syntax
   at .../components/button/style/index.css:3:1
ai commented

Can you add console.log to css-loader sources to see that CSS does it received?

Seems like postcss-simple-vars didn’t transform CSS. Maybe PostCSS doesn’t see the config with the plugins list.

@senya-g Did you mean to write without quotes?

$prefix: foo;

Your version would output .'foo'-button {}, whereas I expect you want .foo-button {}