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
Copy file name to clipboardExpand all lines: README.md
+34-2
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ module.exports = {
66
66
|[**`injectType`**](#injecttype)|`{String}`|`styleTag`| Allows to setup how styles will be injected into the DOM |
67
67
|[**`attributes`**](#attributes)|`{Object}`|`{}`| Adds custom attributes to tag |
68
68
|[**`insert`**](#insert)|`{String\|Function}`|`head`| Inserts tag at the given position into the DOM |
69
-
|[**`styleTagTransform`**](#styleTagTransform)|`{Function}`|`undefined`| Transform tag and css when insert 'style' tag into the DOM |
69
+
|[**`styleTagTransform`**](#styleTagTransform)|`{String\|Function}`|`undefined`| Transform tag and css when insert 'style' tag into the DOM |
70
70
|[**`base`**](#base)|`{Number}`|`true`| Sets module ID base (DLLPlugin) |
71
71
|[**`esModule`**](#esmodule)|`{Boolean}`|`true`| Use ES modules syntax |
72
72
@@ -542,9 +542,41 @@ Insert styles at top of `head` tag.
542
542
543
543
### `styleTagTransform`
544
544
545
-
Type: `Function`
545
+
Type: `String | Function`
546
546
Default: `undefined`
547
547
548
+
#### `String`
549
+
550
+
Allows to setup absolute path to custom function that allows to override default behavior styleTagTransform.
551
+
552
+
> ⚠ 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
553
+
554
+
**webpack.config.js**
555
+
556
+
```js
557
+
module.exports= {
558
+
module: {
559
+
rules: [
560
+
{
561
+
test:/\.css$/i,
562
+
use: [
563
+
{
564
+
loader:"style-loader",
565
+
options: {
566
+
injectType:"styleTag",
567
+
styleTagTransform:require.resolve("module-path"),
568
+
},
569
+
},
570
+
"css-loader",
571
+
],
572
+
},
573
+
],
574
+
},
575
+
};
576
+
```
577
+
578
+
#### `Function`
579
+
548
580
Transform tag and css when insert 'style' tag into the DOM.
549
581
550
582
> ⚠ 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
0 commit comments