Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve more #626

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const divElement = document.createElement("div");
divElement.className = styles["my-class"];
```

All locals (class names) stored in imported object.
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).

**webpack.config.js**

Expand All @@ -138,7 +138,11 @@ module.exports = {
use: [
// The `injectType` option can be avoided because it is default behaviour
{ loader: "style-loader", options: { injectType: "styleTag" } },
"css-loader",
{
loader: "css-loader",
// Uncomment it if you want to use CSS modules
// options: { modules: true }
},
],
},
],
Expand Down Expand Up @@ -184,7 +188,7 @@ const divElement = document.createElement("div");
divElement.className = styles["my-class"];
```

All locals (class names) stored in imported object.
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).

**webpack.config.js**

Expand All @@ -199,7 +203,11 @@ module.exports = {
loader: "style-loader",
options: { injectType: "singletonStyleTag" },
},
"css-loader",
{
loader: "css-loader",
// Uncomment it if you want to use CSS modules
// options: { modules: true }
},
],
},
],
Expand Down Expand Up @@ -253,7 +261,7 @@ const divElement = document.createElement("div");
divElement.className = myClass;
```

All locals (class names) stored in `locals` property of imported object.
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).

**webpack.config.js**

Expand All @@ -270,7 +278,11 @@ module.exports = {
test: /\.lazy\.css$/i,
use: [
{ loader: "style-loader", options: { injectType: "lazyStyleTag" } },
"css-loader",
{
loader: "css-loader",
// Uncomment it if you want to use CSS modules
// options: { modules: true }
},
],
},
],
Expand Down Expand Up @@ -324,7 +336,7 @@ const divElement = document.createElement("div");
divElement.className = myClass;
```

All locals (class names) stored in `locals` property of imported object.
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).

**webpack.config.js**

Expand All @@ -344,7 +356,11 @@ module.exports = {
loader: "style-loader",
options: { injectType: "lazySingletonStyleTag" },
},
"css-loader",
{
loader: "css-loader",
// Uncomment it if you want to use CSS modules
// options: { modules: true }
},
],
},
],
Expand Down