Skip to content

Commit b356e74

Browse files
Document @theme static (#2067)
This PR adds documentation for the new `@theme static` option to always include all CSS variables from a theme block. Merge once tailwindlabs/tailwindcss#16211 is released. --------- Co-authored-by: Philipp Spiess <hello@philippspiess.com>
1 parent e8a38eb commit b356e74

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/docs/theme.mdx

+15
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,21 @@ For example, this text will fall back to `sans-serif` instead of using `Inter` l
499499

500500
This happens because `var(--font-sans)` is resolved where `--font-sans` is defined _(on `#parent`)_, and `--font-inter` has no value there since it's not defined until deeper in the tree _(on `#child`)_.
501501

502+
### Generating all CSS variables
503+
504+
By default only used CSS variables will be generated in the final CSS output. If you want to always generate all CSS variables, you can use the `static` theme option:
505+
506+
```css
507+
/* [!code filename:app.css] */
508+
/* [!code word:static] */
509+
@import "tailwindcss";
510+
511+
@theme static {
512+
--color-primary: var(--color-red-500);
513+
--color-secondary: var(--color-blue-500);
514+
}
515+
```
516+
502517
### Sharing across projects
503518

504519
Since theme variables are defined in CSS, sharing them across projects is just a matter of throwing them into their own CSS file that you can import in each project:

0 commit comments

Comments
 (0)