Skip to content

Update usage of variants when prefix is enabled in tailwind config #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,20 @@ The theme variant generated for the default theme is `defaultTheme` (e.g. `defau
</html>
```

If you've opted to use a prefix in your Tailwind CSS setup, it's essential to include `<prefix><theme name>` alongside the theme class. This ensures proper application of variants. For instance, if your prefix is `tw-` and your theme name is `dark-theme`, you'd use `dark-theme tw-dark-theme` together.

```html
<!doctype html>
<html lang="en">
<head>
<!-- ... -->
</head>
<body class="dark-theme tw-dark-theme">
<!-- Properly utilize prefixes and themes -->
<h1 class="dark-theme:font-bold">Hello world!</h1>
</body>
</html>
```
### Naming

As you probably could tell from above, the names of the generated css variables are the [kebab-cased](https://www.theserverside.com/definition/Kebab-case) version of the variable's path on the config object.
Expand Down
Loading