You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,7 +27,6 @@ React CSS Modules implement automatic mapping of CSS modules. Every CSS class is
25
27
-[`errorWhenNotFound`](#errorwhennotfound)
26
28
-[SASS, SCSS, LESS and other CSS Preprocessors](#sass-scss-less-and-other-css-preprocessors)
27
29
-[Enable Sourcemaps](#enable-sourcemaps)
28
-
-[React Hot Module Replacement](#react-hot-module-replacement)
29
30
-[Class Composition](#class-composition)
30
31
-[What Problems does Class Composition Solve?](#what-problems-does-class-composition-solve)
31
32
-[Class Composition Using CSS Preprocessors](#class-composition-using-css-preprocessors)
@@ -134,8 +135,49 @@ Setup consists of:
134
135
135
136
#### webpack
136
137
137
-
* Install [`style-loader`](https://www.npmjs.com/package/style-loader) and [`css-loader`](https://www.npmjs.com/package/css-loader).
138
-
* You need to use [`extract-text-webpack-plugin`](https://www.npmjs.com/package/extract-text-webpack-plugin) to aggregate the CSS into a single file.
138
+
##### Development
139
+
140
+
In development environment, you want to [Enable Sourcemaps](#enable-sourcemaps) and webpack [Hot Module Replacement](https://webpack.github.io/docs/hot-module-replacement.html) (HMR). [`style-loader`](https://github.com/webpack/style-loader) already supports HMR. Therefore, Hot Module Replacement will work out of the box.
* Use [`extract-text-webpack-plugin`](https://www.npmjs.com/package/extract-text-webpack-plugin) to extract chunks of CSS into a single stylesheet.
139
181
* Setup `/\.css$/` loader:
140
182
141
183
```js
@@ -155,7 +197,7 @@ new ExtractTextPlugin('app.css', {
155
197
156
198
Refer to [webpack-demo](https://github.com/css-modules/webpack-demo) or [react-css-modules-examples](https://github.com/gajus/react-css-modules-examples) for an example of a complete setup.
157
199
158
-
#### Browserify
200
+
#####Browserify
159
201
160
202
Refer to [`css-modulesify`](https://github.com/css-modules/css-modulesify).
161
203
@@ -421,31 +463,31 @@ Throws an error when `styleName` cannot be mapped to an existing CSS Module.
[Hot module reloading](https://github.com/gaearon/react-transform-hmr) (HMR) does not reload the CSS document (see https://github.com/gajus/react-css-modules/issues/51). It only reloads the `class` HTML attribute value.
442
-
443
-
To enable CSS reloading, wrap [`webpack-dev-server`](https://webpack.github.io/docs/webpack-dev-server.html) configuration using [BrowserSync](https://www.browsersync.io/). BrowserSync enables CSS reloading when it detects a file change.
444
-
445
-
[React CSS Modules examples](https://github.com/gajus/react-css-modules-examples) repository includes a configuration example using [BrowserSync configuration using webpack-dev-server](https://github.com/gajus/react-css-modules-examples/blob/master/webpack.config.browsersync.js).
446
-
447
-
Note that `webpack-dev-server` program [does not write bundle files to the disk](https://github.com/webpack/webpack-dev-server/issues/62). Use [write-file-webpack-plugin](https://github.com/gajus/write-file-webpack-plugin) plugin to force writing to the disk. This will enable BrowserSync to detect changes.
448
-
449
491
## Class Composition
450
492
451
493
CSS Modules promote composition pattern, i.e. every CSS Module that is used in a component should define all properties required to describe an element, e.g.
0 commit comments