Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
document @theme static
  • Loading branch information
RobinMalfait committed Feb 6, 2025
commit 676e29a141a94a8b885d298f73e69fab35df0aab
17 changes: 17 additions & 0 deletions src/docs/theme.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,23 @@ For example, this text will fall back to `sans-serif` instead of using `Inter` l

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`)_.

### Generating all CSS variables

By default only the 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:

```css
/* [!code filename:app.css] */
/* [!code word:static] */
@import "tailwindcss";

@theme static {
--color-primary: var(--color-red-500);
--color-secondary: var(--color-blue-500);
}
```

### Sharing across projects

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:
Expand Down