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
|`isolateInsideOfContainer`<br/><imgsrc="docs/inside.png"alt="inside"width="220"/> | Everything is protected from the preflight styles, except specified Tailwind root(s).<br/>Use it when you have all the tailwind-powered stuff **isolated under some root container**. |
40
-
|`isolateOutsideOfContainer`<br/><imgsrc="docs/outside.png"alt="outside"width="220"/> | Protects specific root(s) from the preflight styles - Tailwind is everywhere outside.<br/>Use it when you have Tailwind powered stuff everywhere as usual, but you want to **exclude some part of the DOM** from being affected by the preflight styles. |
41
-
|`isolateForComponents`<br/><imgsrc="docs/components.png"alt="components"width="220"/> |Everything is protected from the preflight styles, except components marked with the selector of your choice.<br/>Use it when you want the preflight styles to be applied only to particular elements **immediately** (without extra roots or wrappers).<br/>Good for components - just specify some unique css class for all your components and use them anywhere. |
|`isolateInsideOfContainer`<br/><imgsrc="docs/inside.png"alt="inside"width="220"/> | Everything is protected from the preflight styles, except specified Tailwind root(s).<br/>Use it when you have all the tailwind-powered stuff **isolated under some root container**.|
40
+
|`isolateOutsideOfContainer`<br/><imgsrc="docs/outside.png"alt="outside"width="220"/> | Protects specific root(s) from the preflight styles - Tailwind is everywhere outside.<br/>Use it when you have Tailwind powered stuff everywhere as usual, but you want to **exclude some part of the DOM** from being affected by the preflight styles.|
41
+
|~~`isolateForComponents`~~ (deprecated)<br/><imgsrc="docs/components.png"alt="components"width="220"/> |It generates the same CSS as `isolateInsideOfContainer` with small difference about root styles - so I just put it as an option of `isolateInsideOfContainer` strategy to simplify the strategy selection while still be able to use both modes if needed. If you use this strategy - migrate to `isolateInsideOfContainer` and set `rootStyles` to `add :where` for the same effect). |
42
42
43
43
🔨 If none of these strategies work for your case, or something isn't perfect - you can [create your own strategy](#your-owncustom-isolation-strategy).
44
44
@@ -52,7 +52,8 @@ npm i -D tailwindcss-scoped-preflight
52
52
53
53
### 2. Update your Tailwind CSS configuration
54
54
55
-
#### 2.1 Case: you want to lock Tailwind preflight styles inside of some root container (or multiple containers), so they couldn't affect the rest of your page.
55
+
#### 2.1 Case: you want to lock Tailwind preflight styles inside of some root container (or multiple containers), so they couldn't affect the rest of your web page.
|`plus` (optional) | CSS selector | if you have your Tailwind components under .no-twp, you need them to be preflighted. Specify their root selector with this option |
* Isolates the TailwindCSS preflight styles inside of the container (assuming all the TailwindCSS is inside of this container)
24
27
*
25
28
* @param containerSelectors
26
29
* @param options
27
30
* @param options.ignore - list of preflight CSS selectors to ignore (don't isolate) - these will not be affected by the transformation
28
31
* @param options.remove - list of preflight CSS selectors to remove from the final CSS - use it if you have any specific conflicts and really want to remove some preflight rules
32
+
* @param options.rootStyles - 'move to container' (default) - moves the root styles to the container styles (by simply replacing the selector), 'add :where' - adds ` :where` to the root selector so styles are still in roots, but only matching items would be affected
0 commit comments