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
* Replace :root, body, html with the prefix
* Add details about global selectors
* Add option to not transform global selectors
* Merge redundant descriptions
Please note that global selectors (`html`, `body`, `:root`) cannot be prefixed so instead they will be replaced with the prefix. This behaviour can be disabled with the `skipGlobalSelectors` option.
68
65
69
66
```css
70
-
body.some-selector {
71
-
background: red;
72
-
}
67
+
/* Input */
68
+
:root { --bs-blue:#0d6efd; }
69
+
html { padding: 0; }
70
+
body { margin: 0; }
71
+
72
+
/* Output */
73
+
.namespace { --bs-blue:#0d6efd; }
74
+
.namespace { padding: 0; }
75
+
.namespace { margin: 0; }
76
+
```
73
77
74
-
.some-selector.a, .some-selector.b {
75
-
color: aqua;
78
+
It's also possible to customize the way prefixing is done by defining a transform function:
79
+
80
+
```js
81
+
constout=postcss().use(prefixer({
82
+
prefix:'.namespace',
83
+
// Optional transform callback for case-by-case overrides
| `transform` | `Function` | In cases where you may want to use the prefix differently for different selectors, it is possible to pass in a custom transform method |
181
204
| `ignoreFiles` | `string[]` or `RegExp[]` | List of ignored files for processing |
182
205
| `includeFiles` | `string[]` or `RegExp[]` | List of included files for processing |
206
+
| `skipGlobalSelectors` | `boolean` | When enabled, global selectors (`html`, `body`, `root`) won't be modified by the prefixer. Default: `false`. |
183
207
184
208
## Maintainer
185
209
@@ -193,7 +217,7 @@ This project uses Mocha. If you submit a PR, please add appropriate tests and ma
0 commit comments