gajus / babel-plugin-react-css-modules

Transforms styleName to className using compile time CSS module resolution.
Other
2.05k stars 162 forks source link

Feature: make postcss configurable #83

Open jescalan opened 7 years ago

jescalan commented 7 years ago

I like to use postcss to transform css with certain plugins, and wouldn't want to have to give this up in order to use this plugin. Luckily, it already uses postcss, so it should be pretty trivial to expose an option to process with additional postcss plugins if needed. I'd be happy to pull request this in, just wanted to open this issue to bring it up and see if maintainers had any thoughts!

gajus commented 7 years ago

The reason this doesn't exist at the moment is simple... the only case where I wanted to have a postcss plugin was to enable certain async transformations (e.g. imports via postcss scss plugin).

The problem is that Babel does not allow any async operations in the transpiler. The only possible workaround (without reimplementing the async plugin) for the async transformations is to use something like https://github.com/abbr/deasync (However, thats far from ideal.)

If your use case does not require async transformations then this does not effect you. A PR would be most welcome.

gajus commented 7 years ago

Might need to have a look at https://github.com/wbyoung/babel-plugin-transform-postcss.