cuth / postcss-pxtorem

Convert pixel units to rem (root em) units using PostCSS
MIT License
2.03k stars 174 forks source link

Support for css module `@value`? #47

Closed fnlctrl closed 6 years ago

fnlctrl commented 6 years ago

Hi, thanks for this aweseome plugin! I'm currently using css modules and found that @value rules are not being transformed, for example

@value foo: 16px;
.bar {
  font-size: foo;
  line-height: 32px;
}

is transformed to

.bar {
  font-size: 16px;
  line-height: 2em;
}

where the @value variable is missed out. It would be great if @value is supported.

cuth commented 6 years ago

Is that a PostCSS plugin that makes @value work? I'm wondering if you can just change the order and run this plugin last.

fnlctrl commented 6 years ago

The @value support is enabled by css-loader with a config { modules: true }. After some digging I found that with this config it applies its own set of plugins for postcss (list can be found here"). So I guess it's up to css-loader to support passing custom css plugins, and there's probably nothing this plugin can do. Thanks for the reply! Closing this issue for now.