Skip to content

Commit abc0b5f

Browse files
docs: improve more
1 parent 565362c commit abc0b5f

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const divElement = document.createElement("div");
125125
divElement.className = styles["my-class"];
126126
```
127127

128-
All locals (class names) stored in imported object.
128+
All local variables (class names) are exported as named exports. To achieve this behaviour you also have to setup `modules` option for `css-loader`. For more information consult with `css-loader` [`documentation`](https://github.com/webpack-contrib/css-loader).
129129

130130
**webpack.config.js**
131131

@@ -138,7 +138,11 @@ module.exports = {
138138
use: [
139139
// The `injectType` option can be avoided because it is default behaviour
140140
{ loader: "style-loader", options: { injectType: "styleTag" } },
141-
"css-loader",
141+
{
142+
loader: "css-loader",
143+
// Uncomment it if you want to use CSS modules
144+
// options: { modules: true }
145+
},
142146
],
143147
},
144148
],
@@ -184,7 +188,7 @@ const divElement = document.createElement("div");
184188
divElement.className = styles["my-class"];
185189
```
186190

187-
All locals (class names) stored in imported object.
191+
All local variables (class names) are exported as named exports. To achieve this behaviour you also have to setup `modules` option for `css-loader`. For more information consult with `css-loader` [`documentation`](https://github.com/webpack-contrib/css-loader).
188192

189193
**webpack.config.js**
190194

@@ -199,7 +203,11 @@ module.exports = {
199203
loader: "style-loader",
200204
options: { injectType: "singletonStyleTag" },
201205
},
202-
"css-loader",
206+
{
207+
loader: "css-loader",
208+
// Uncomment it if you want to use CSS modules
209+
// options: { modules: true }
210+
},
203211
],
204212
},
205213
],
@@ -253,7 +261,7 @@ const divElement = document.createElement("div");
253261
divElement.className = myClass;
254262
```
255263

256-
All locals (class names) stored in `locals` property of imported object.
264+
All local variables (class names) are exported as named exports. To achieve this behaviour you also have to setup `modules` option for `css-loader`. For more information consult with `css-loader` [`documentation`](https://github.com/webpack-contrib/css-loader).
257265

258266
**webpack.config.js**
259267

@@ -270,7 +278,11 @@ module.exports = {
270278
test: /\.lazy\.css$/i,
271279
use: [
272280
{ loader: "style-loader", options: { injectType: "lazyStyleTag" } },
273-
"css-loader",
281+
{
282+
loader: "css-loader",
283+
// Uncomment it if you want to use CSS modules
284+
// options: { modules: true }
285+
},
274286
],
275287
},
276288
],
@@ -324,7 +336,7 @@ const divElement = document.createElement("div");
324336
divElement.className = myClass;
325337
```
326338

327-
All locals (class names) stored in `locals` property of imported object.
339+
All local variables (class names) are exported as named exports. To achieve this behaviour you also have to setup `modules` option for `css-loader`. For more information consult with `css-loader` [`documentation`](https://github.com/webpack-contrib/css-loader).
328340

329341
**webpack.config.js**
330342

@@ -344,7 +356,11 @@ module.exports = {
344356
loader: "style-loader",
345357
options: { injectType: "lazySingletonStyleTag" },
346358
},
347-
"css-loader",
359+
{
360+
loader: "css-loader",
361+
// Uncomment it if you want to use CSS modules
362+
// options: { modules: true }
363+
},
348364
],
349365
},
350366
],

0 commit comments

Comments
 (0)