Skip to content

Commit 300d088

Browse files
committed
docs: explain generated css
1 parent cccfc68 commit 300d088

File tree

1 file changed

+28
-2
lines changed
  • docs/content/guides/7.multistore/3.patterns/5.subpath

1 file changed

+28
-2
lines changed

Diff for: docs/content/guides/7.multistore/3.patterns/5.subpath/1.subpath.md

+28-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,21 @@ In your Nuxt app, add custom CSS variables in your style.scss:
199199
```
200200
::
201201

202-
::info
203-
For more information on using CSS variables with Tailwind, see the [Tailwind CSS documentation](https://v3.tailwindcss.com/docs/customizing-colors#using-css-variables).
202+
::tip Using CSS Variables with Tailwind
203+
The CSS variables we defined can be used with Tailwind's color system. For example, `bg-primary-500` will use the store-specific primary color defined in the CSS variables. For more information, see the [Tailwind CSS documentation](https://v3.tailwindcss.com/docs/customizing-colors#using-css-variables).
204+
::
205+
206+
::tip Understanding Generated CSS
207+
When using store-specific variants like `electronics:!bg-primary-600`, Tailwind generates scoped CSS rules. For example:
208+
209+
```css
210+
.electronics .electronics\:\!bg-primary-600 {
211+
--tw-bg-opacity: 1 !important;
212+
background-color: rgb(46 106 230 / 1 !important) !important;
213+
}
214+
```
215+
216+
This ensures the styles only apply when two conditions are met: the parent element must have the `.electronics` class and the target element must have the `electronics:!bg-primary-600` class.
204217
::
205218

206219
## Setting Up the Storefront
@@ -575,6 +588,19 @@ Then use these variants (`electronics:`, `apparel:`, etc.) in your components:
575588
The CSS variables we defined can be used with Tailwind's color system. For example, `bg-primary-500` will use the store-specific primary color defined in the CSS variables. For more information, see the [Tailwind CSS documentation](https://v3.tailwindcss.com/docs/customizing-colors#using-css-variables).
576589
::
577590

591+
::tip Understanding Generated CSS
592+
When using store-specific variants like `electronics:!bg-primary-600`, Tailwind generates scoped CSS rules. For example:
593+
594+
```css
595+
.electronics .electronics\:\!bg-primary-600 {
596+
--tw-bg-opacity: 1 !important;
597+
background-color: rgb(46 106 230 / 1 !important) !important;
598+
}
599+
```
600+
601+
This ensures the styles only apply when two conditions are met: the parent element must have the `.electronics` class and the target element must have the `electronics:!bg-primary-600` class.
602+
::
603+
578604
## Conditional Components
579605

580606
There are two main approaches to handling store-specific components:

0 commit comments

Comments
 (0)