You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
128
+
All local variables (class names) are exported as named exports. To achieve this behaviour you also have to set up the `modules` option for `css-loader`. For more information, consult the`css-loader`[`documentation`](https://github.com/webpack-contrib/css-loader).
129
129
130
130
**webpack.config.js**
131
131
@@ -167,7 +167,7 @@ The loader inject styles like:
167
167
168
168
#### `singletonStyleTag`
169
169
170
-
Automatically injects styles into the DOM using one `<style></style>`.
170
+
Automatically injects styles into the DOM using a single `<style></style>` tag.
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).
191
+
All local variables (class names) are exported as named exports. To achieve this behaviour, you also have to set up the `modules` option for `css-loader`. For more information, consult the`css-loader`[`documentation`](https://github.com/webpack-contrib/css-loader).
192
192
193
193
**webpack.config.js**
194
194
@@ -234,9 +234,11 @@ Works the same as a [`styleTag`](#styleTag), but if the code is executed in IE6-
234
234
235
235
#### `lazyStyleTag`
236
236
237
-
Injects styles into the DOM using multiple `<style></style>` on demand.
238
-
We recommend following `.lazy.css` naming convention for lazy styles and the `.css` for basic `style-loader` usage (similar to other file types, i.e. `.lazy.less` and `.less`).
239
-
When you `lazyStyleTag` value the `style-loader` injects the styles lazily making them useable on-demand via `style.use()` / `style.unuse()`.
237
+
Injects styles into the DOM using multiple `<style></style>` tags on demand.
238
+
239
+
We recommend following the `.lazy.css` naming convention for lazy styles and `.css` for basic `style-loader` usage (similar to other file types, i.e. `.lazy.less` and `.less`).
240
+
241
+
When you use the `lazyStyleTag` value, `style-loader` injects the styles lazily, making them useable on-demand via `style.use()` / `style.unuse()`.
240
242
241
243
> ⚠️ Behavior is undefined when `unuse` is called more often than `use`. Don't do that.
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).
266
+
All local variables (class names) are exported as named exports. To achieve this behaviour, you also have to set up the `modules` option for `css-loader`. For more information, consult the`css-loader`[`documentation`](https://github.com/webpack-contrib/css-loader).
265
267
266
268
**webpack.config.js**
267
269
@@ -307,9 +309,11 @@ The loader inject styles like:
307
309
308
310
#### `lazySingletonStyleTag`
309
311
310
-
Injects styles into the DOM using one `<style></style>` on demand.
312
+
Injects styles into the DOM using a single `<style></style>` tag on demand.
313
+
311
314
We recommend following `.lazy.css` naming convention for lazy styles and the `.css` for basic `style-loader` usage (similar to other file types, i.e. `.lazy.less` and `.less`).
312
-
When you `lazySingletonStyleTag` value the `style-loader` injects the styles lazily making them useable on-demand via `style.use()` / `style.unuse()`.
315
+
316
+
When you use the `lazySingletonStyleTag` value, `style-loader` injects the styles lazily making them useable on-demand via `style.use()` / `style.unuse()`.
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).
343
+
All local variables (class names) are exported as named exports. To achieve this behaviour, you also have to set up the `modules` option for `css-loader`. For more information, consult the`css-loader`[`documentation`](https://github.com/webpack-contrib/css-loader).
340
344
341
345
**webpack.config.js**
342
346
@@ -431,7 +435,7 @@ type attributes = HTMLAttributes;
431
435
432
436
Default: `{}`
433
437
434
-
If defined, the `style-loader` will attach given attributes with their values on `<style>` / `<link>` element.
438
+
If defined, the `style-loader` will attach the given attributes with their values on `<style>` / `<link>` element.
435
439
436
440
**component.js**
437
441
@@ -472,13 +476,16 @@ type insert = string;
472
476
Default: `head`
473
477
474
478
By default, the `style-loader` appends `<style>`/`<link>` elements to the end of the style target, which is the `<head>` tag of the page unless specified by `insert`.
479
+
475
480
This will cause CSS created by the loader to take priority over CSS already present in the target.
481
+
476
482
You can use other values if the standard behavior is not suitable for you, but we do not recommend doing this.
477
-
If you target an [iframe](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement) make sure you have sufficient access rights, the styles will be injected into the content document head.
483
+
484
+
If you target an [iframe](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement), make sure you have sufficient access rights; the styles will be injected into the content document head.
478
485
479
486
#### `Selector`
480
487
481
-
Allows to setup custom [query selector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) where styles inject into the DOM.
488
+
Allows you to setup custom [query selector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) where styles are injected into the DOM.
482
489
483
490
**webpack.config.js**
484
491
@@ -505,15 +512,15 @@ module.exports = {
505
512
506
513
#### `Absolute path to function`
507
514
508
-
Allows to setup absolute path to custom function that allows to override default behavior and insert styles at any position.
515
+
Allows you to setup an absolute path to custom function that allows to override the default behavior and insert styles at any position.
509
516
510
517
> [!WARNING]
511
518
>
512
-
> Do not forget that this code will be used in the browser and not all browsers support latest ECMA features like `let`, `const`, `arrow function expression` and etc. We recommend using [`babel-loader`](https://webpack.js.org/loaders/babel-loader/)for support latest ECMA features.
519
+
> Do not forget that this code will be used in the browser and not all browsers support latest ECMA features like `let`, `const`, `arrow function expression`, etc. We recommend using [`babel-loader`](https://webpack.js.org/loaders/babel-loader/)to support the latest ECMA features.
513
520
514
521
> [!WARNING]
515
522
>
516
-
> Do not forget that some DOM methods may not be available in older browsers, we recommended use only [DOM core level 2 properties](https://caniuse.com/#search=DOM%20Core), but it is depends what browsers you want to support
523
+
> Do not forget that some DOM methods may not be available in older browsers. We recommended using only [DOM core level 2 properties](https://caniuse.com/#search=DOM%20Core), but it depends on which browsers you want to support.
517
524
518
525
**webpack.config.js**
519
526
@@ -538,7 +545,7 @@ module.exports = {
538
545
};
539
546
```
540
547
541
-
A new `<style>`/`<link>` elements will be inserted into at bottom of `body` tag.
548
+
New `<style>`/`<link>` elements will be inserted at the bottom of the`body` tag.
542
549
543
550
Examples:
544
551
@@ -590,7 +597,7 @@ module.exports = {
590
597
};
591
598
```
592
599
593
-
You can pass any parameters to `style.use(options)` and this value will be passed to `insert` and `styleTagTransform` functions.
600
+
You can pass any parameters to `style.use(options)` and this value will be passed to the `insert` and `styleTagTransform` functions.
594
601
595
602
**insert-function.js**
596
603
@@ -693,15 +700,15 @@ Default: `undefined`
693
700
694
701
#### `string`
695
702
696
-
Allows to setup absolute path to custom function that allows to override default behavior styleTagTransform.
703
+
Allows you to setup an absolute path to a custom function that allows to override default `styleTagTransform` behavior.
697
704
698
705
> [!WARNING]
699
706
>
700
-
> Do not forget that this code will be used in the browser and not all browsers support latest ECMA features like `let`, `const`, `arrow function expression` and etc, we recommend use only ECMA 5 features, but it is depends what browsers you want to support
707
+
> Do not forget that this code will be used in the browser and not all browsers support latest ECMA features like `let`, `const`, `arrow function expression`, etc. We recommend use only ECMA 5 features, but it depends on which browsers you want to support.
701
708
702
709
> [!WARNING]
703
710
>
704
-
> Do not forget that some DOM methods may not be available in older browsers, we recommended use only [DOM core level 2 properties](https://caniuse.com/#search=DOM%20Core), but it depends what browsers you want to support
711
+
> Do not forget that some DOM methods may not be available in older browsers. We recommended using only [DOM core level 2 properties](https://caniuse.com/#search=DOM%20Core), but it depends on which browsers you want to support.
705
712
706
713
**webpack.config.js**
707
714
@@ -733,7 +740,8 @@ module.exports = {
733
740
typebase=number;
734
741
```
735
742
736
-
This setting is primarily used as a workaround for [css clashes](https://github.com/webpack-contrib/style-loader/issues/163) when using one or more [DllPlugin](https://robertknight.me.uk/posts/webpack-dll-plugins/)'s. `base` allows you to prevent either the _app_'s css (or _DllPlugin2_'s css) from overwriting _DllPlugin1_'s css by specifying a css module id base which is greater than the range used by _DllPlugin1_ e.g.:
743
+
This setting is primarily used as a workaround for [CSS clashes](https://github.com/webpack-contrib/style-loader/issues/163) when using one or more [DllPlugin](https://robertknight.me.uk/posts/webpack-dll-plugins/)s.
744
+
`base` allows you to prevent either the _app_'s CSS (or _DllPlugin2_'s css) from overwriting _DllPlugin1_'s CSS by specifying a CSS module ID base that is greater than the range used by _DllPlugin1_ e.g.:
737
745
738
746
**webpack.dll1.config.js**
739
747
@@ -797,9 +805,10 @@ type esModule = boolean;
797
805
Default: `true`
798
806
799
807
By default, `style-loader` generates JS modules that use the ES modules syntax.
800
-
There are some cases in which using ES modules is beneficial, like in the case of [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/) and [tree shaking](https://webpack.js.org/guides/tree-shaking/).
801
808
802
-
You can enable a CommonJS modules syntax using:
809
+
There are some cases in which using ES modules is beneficial, such as in the case of [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/) and [tree shaking](https://webpack.js.org/guides/tree-shaking/).
810
+
811
+
You can enable a CommonJS module syntax using:
803
812
804
813
**webpack.config.js**
805
814
@@ -821,15 +830,15 @@ module.exports = {
821
830
822
831
## Examples
823
832
824
-
### Recommend
833
+
### Recommended
825
834
826
-
For `production` builds it's recommended to extract the CSS from your bundle being able to use parallel loading of CSS/JS resources later on.
827
-
This can be achieved by using the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin), because it creates separate css files.
828
-
For `development` mode (including `webpack-dev-server`) you can use `style-loader`, because it injects CSS into the DOM using multiple `<style></style>` and works faster.
835
+
For `production` builds, it's recommended to extract the CSS from your bundle to enable parallel loading of CSS/JS resources later on.
836
+
This can be achieved by using the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin), because it creates separate CSS files.
837
+
For `development` mode (including `webpack-dev-server`), you can use `style-loader`, because it injects CSS into the DOM using multiple `<style></style>` tags and works faster.
829
838
830
839
> [!WARNING]
831
840
>
832
-
> Do not use together `style-loader` and `mini-css-extract-plugin`.
841
+
> Do not use `style-loader` and `mini-css-extract-plugin` together.
833
842
834
843
**webpack.config.js**
835
844
@@ -859,7 +868,7 @@ module.exports = {
859
868
860
869
> [!WARNING]
861
870
>
862
-
> It is not allowed to use JavaScript reserved words in css class names.
871
+
> It is not allowed to use JavaScript reserved words in CSS class names.
863
872
864
873
> [!WARNING]
865
874
>
@@ -897,7 +906,7 @@ import * as styles from "./styles.css";
0 commit comments