Skip to content

Commit 67007d1

Browse files
committed
webpack description
1 parent ffaed56 commit 67007d1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

demo/readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ In short [CSS Modules](https://github.com/css-modules/css-modules) provide modul
2626

2727
The modern frontend is so tough that you have to use particular bundler systems in order to generate a simple CSS file. My favourite one is [webpack](https://webpack.github.io/), so I'll show you how to set it with the require hook.
2828

29+
To understand [webpack](https://webpack.github.io/) configs you should be familiar with [loaders](https://webpack.github.io/docs/using-loaders.html). In order to use [CSS Modules](https://github.com/css-modules/css-modules) with [webpack](https://webpack.github.io/) you should set [css-loader](https://github.com/webpack/css-loader#css-modules). Also [extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin) provides you possibility to create pure CSS file. So eventually, your configuration should look similar to this:
30+
31+
```javascript
32+
module: {
33+
loaders: [
34+
{
35+
test: /\.css$/i,
36+
loader: ExtractTextPlugin.extract('style',
37+
'css?modules&localIdentName=[name]_[local]__[hash:base64:5]'),
38+
},
39+
],
40+
},
41+
42+
plugins: [
43+
new ExtractTextPlugin('styles.css', {
44+
allChunks: true
45+
}),
46+
],
47+
```
2948

3049
### Backend
3150

0 commit comments

Comments
 (0)