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: docs/guide/api-environment-plugins.md
+33-1
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,8 @@ const UnoCssPlugin = () => {
142
142
// use global hooks normally
143
143
},
144
144
applyToEnvironment(environment) {
145
-
// return true if this plugin should be active in this environment
145
+
// return true if this plugin should be active in this environment,
146
+
// or return a new plugin to replace it.
146
147
// if the hook is not used, the plugin is active in all environments
147
148
},
148
149
resolveId(id, importer) {
@@ -152,6 +153,37 @@ const UnoCssPlugin = () => {
152
153
}
153
154
```
154
155
156
+
If a plugin isn't environment aware and has state that isn't keyed on the current environment, the `applyToEnvironment` hook allows to easily make it per-environment.
0 commit comments