michalkvasnicak / babel-plugin-css-modules-transform

Extract css class names from required css module files, so we can render it on server.
MIT License
326 stars 54 forks source link

Why is this plugin "intended only for backend compilation"? #51

Closed danny-andrews closed 7 years ago

danny-andrews commented 7 years ago

In the docs, it says that this plugin "is intended only for backend compilation," but I see no reason why it can't be used for frontend compilation as well.

p.s. Sorry for asking a question in a GitHub issue (I know that's bad form). However, I believe it is an actual issue with the docs.

michalkvasnicak commented 7 years ago

@danny-andrews It means the plugin isn't optimized to be used as frontend tool (e.g. watching your source code like webpack does and compiling on change in css files). Of course you can use it for front end compilation for example building your app for production (single pass build).

However I see your point and if this is causing a confusion then I should edit the docs :) So thank you 👍

danny-andrews commented 7 years ago

Yeah, the note just made me think there was some reason it couldn't be used for front-end builds at all (because it injected some node runtime-dependent code or something). But I'm using it to transform css-module imports in my React app and its working like a dream. Just didn't want potential users to be dissuaded unnecessarily. ;P

danny-andrews commented 7 years ago

I don't think this is a big deal, actually. I went back to pre-compiling my frontend stuff with webpack and only using this for SSR. Sorry for the noise!