Skip to content

Commit 4582e70

Browse files
committed
Merge pull request webpack#41 from iamakulov/patch-1
Add info about integration with CSS Modules
2 parents e36b2ea + ad7cec6 commit 4582e70

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ module.exports = {
123123
[webpack loader-context]: http://webpack.github.io/docs/loaders.html#loader-context
124124
[postcss-import]: https://github.com/postcss/postcss-import
125125

126+
## Integration with CSS Modules
127+
128+
postcss-loader [cannot be used] with [CSS Modules] out of the box due to the way css-loader processes file imports. To make them work property, either add the css-loader’s [`importLoaders` option]:
129+
130+
```js
131+
{
132+
test: /\.css$/,
133+
loader: "style-loader!css-loader?modules&importLoaders=1!postcss-loader"
134+
}
135+
```
136+
137+
or replace css-loader with [postcss-modules] plugin.
138+
139+
[cannot be used]: https://github.com/webpack/css-loader/issues/137
140+
[CSS Modules]: https://github.com/webpack/css-loader#css-modules
141+
[`importLoaders` option]: github.com/webpack/css-loader#importing-and-chained-loaders
142+
[postcss-modules]: https://github.com/outpunk/postcss-modules
143+
126144
## JS Styles
127145

128146
If you want to process styles written in JavaScript

0 commit comments

Comments
 (0)