gajus / babel-plugin-react-css-modules

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

Create option to generate className even if style is missing #217

Closed antonholmquist closed 5 years ago

antonholmquist commented 5 years ago

This is a use case I have that creates problem with webpack dev middleware:

  1. Add style to a React element that doesn't yet have a corresponding class in the css file
  2. Add the class to the css file
  3. Webpack would need to reload the js file to resolve again, so I need to go to the js file and re-save it to trigger the reload.

This could probably be fixed with an option to generate classNames even though no corresponding class yet exist.

What's your view on this? I can see this would be useful during development and with certain setups.

Would also like to add that I'm very happy with this plugin! Thank you so much for putting it together.

gajus commented 5 years ago

https://github.com/gajus/babel-plugin-react-css-modules/issues/135