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
[#111] Make styleId an optional string or function (#110)
* feat: allow for unique styleId when relativeCssInjection
* fix: remove dash when there is no styleId
* fix: only run changes if styleId exists
* fix: move uuid to devDependencies + update README
* fix: PR comments
* fix: remove empty line
* fix: remove empty line
* fix: remove empty line
* fix: remove unused duplicate test
* refactor: styleId as callback function
Copy file name to clipboardExpand all lines: README.md
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,9 +53,9 @@ export default {
53
53
}
54
54
```
55
55
56
-
#### styleId (string)
56
+
#### styleId (string | function)
57
57
58
-
If you provide a `string` for `styleId` param the code of injection will set the `id` attribute of the `style` element
58
+
If you provide a `string` for `styleId` param, the code of injection will set the `id` attribute of the `style` element
59
59
with the value of the parameter provided. This is an example:
60
60
61
61
```ts
@@ -77,6 +77,25 @@ The output injected into the DOM will look like this example:
77
77
</head>
78
78
```
79
79
80
+
If you provide a `function` for `styleId` param, it will run that function and return a string. It's especially useful if you use `relativeCSSInjection` and want unique styleIds for each file.
0 commit comments