File tree Expand file tree Collapse file tree 1 file changed +37
-11
lines changed
Expand file tree Collapse file tree 1 file changed +37
-11
lines changed Original file line number Diff line number Diff line change @@ -182,22 +182,48 @@ Setup:
182182* Install [ ` style-loader ` ] ( https://www.npmjs.com/package/style-loader ) .
183183* Install [ ` css-loader ` ] ( https://www.npmjs.com/package/css-loader ) .
184184* Use [ ` extract-text-webpack-plugin ` ] ( https://www.npmjs.com/package/extract-text-webpack-plugin ) to extract chunks of CSS into a single stylesheet.
185+
185186* Setup ` /\.css$/ ` loader:
186187
187- ``` js
188- {
189- test: / \. css$ / ,
190- loader: ExtractTextPlugin .extract (' style' , ' css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' )
191- }
192- ```
188+ * ExtractTextPlugin v1x:
189+
190+ ``` js
191+ {
192+ test: / \. css$ / ,
193+ loader: ExtractTextPlugin .extract (' style' , ' css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' )
194+ }
195+ ```
196+
197+ * ExtractTextPlugin v2x:
198+
199+ ` ` ` js
200+ {
201+ test: /\. css$/,
202+ loader: ExtractTextPlugin.extract({
203+ notExtractLoader: 'style-loader',
204+ loader: 'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]!resolve-url!postcss',
205+ }),
206+ }
207+ ` ` `
193208
194209* Setup ` extract-text-webpack-plugin` plugin:
195210
196- ``` js
197- new ExtractTextPlugin (' app.css' , {
198- allChunks: true
199- })
200- ```
211+ * ExtractTextPlugin v1x:
212+
213+ ` ` ` js
214+ new ExtractTextPlugin('app.css', {
215+ allChunks: true
216+ })
217+ ` ` `
218+
219+ * ExtractTextPlugin v2x:
220+
221+ ` ` ` js
222+ new ExtractTextPlugin({
223+ filename: 'app.css',
224+ allChunks: true
225+ })
226+ ` ` `
201227
202228Refer 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.
203229
You can’t perform that action at this time.
0 commit comments