Setting up CSS Modules
CSS Modules works by compiling individual CSS files into both CSS and data. The CSS output is normal, global CSS, which can be injected directly into the browser or concatenated together and written to a file for production use. The data is used to map the human-readable names you've used in the files to the globally-safe output CSS.
There are currently 4 ways to integrate CSS Modules into your project. You should look to each of these projects for more detailed setup instructions.
The css-modules-require-hook works similarly to the Browserify plugin, but patches NodeJS's
require to interpret CSS files as CSS Modules. This gives complete flexibility in how the output is handled, ideal for server-side rendering.
If you're using React, CSS Modules is a great fit. react-css-modules adds a
CSSModules higher-order component or
@CSSModules annotation for better integrating CSS Modules & React.
If you're using Deku, CSS Modules is an awesome fit. deku-css-modules allows for easy integration of CSS Modules & Deku.