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
{{ message }}
Repository navigation
Process stylesheets that only use @theme in @tailwindcss/vite - #20599
@tailwindcss/vite only hands a stylesheet to Tailwind when it uses @apply, @plugin/@config, theme(…), @tailwind utilities or @variant. A stylesheet that only uses @theme is returned as-is:
vite build emits this file unchanged, so the browser gets the raw @theme block and --color-brand is never defined. Compiling the same CSS with tailwindcss directly (or with @tailwindcss/postcss) gives :root, :host { --color-brand: red; } and the .brand rule.
Features.AtTheme was added in #18979 for this case, but the Vite plugin's check wasn't updated. This adds Features.AtTheme to it.
Test plan
Added production build with a stylesheet that only uses @theme to integrations/vite/index.test.ts. On main it fails because the CSS still contains the @theme { … } block; with this change the output has the :root, :host declaration and the .brand rule.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b08e7a6d-fd49-4817-87da-f950da407f35
📥 Commits
Reviewing files that changed from the base of the PR and between 8cc0551 and 6986fb2.
📒 Files selected for processing: 3
CHANGELOG.md
integrations/vite/index.test.ts
packages/@tailwindcss-vite/src/index.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Walkthrough
Root.generate now continues CSS generation when the compiler feature mask includes Features.AtTheme. A Vite production-build test checks that a theme-only stylesheet produces the expected custom property and preserves its variable reference. The changelog records the change.
Priority: ⬇️ Low
Merge Risk:⚪ Minimal · up to 6986f
The change is ready to merge after normal checks; no actionable issue was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: processing stylesheets that use only @theme in @tailwindcss/vite.
Description check
The description is directly related to the changeset. It explains the @theme processing issue, the code change, and the added integration test.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@tailwindcss/viteonly hands a stylesheet to Tailwind when it uses@apply,@plugin/@config,theme(…),@tailwind utilitiesor@variant. A stylesheet that only uses@themeis returned as-is:vite buildemits this file unchanged, so the browser gets the raw@themeblock and--color-brandis never defined. Compiling the same CSS withtailwindcssdirectly (or with@tailwindcss/postcss) gives:root, :host { --color-brand: red; }and the.brandrule.Features.AtThemewas added in #18979 for this case, but the Vite plugin's check wasn't updated. This addsFeatures.AtThemeto it.Test plan
production build with a stylesheet that only uses @themetointegrations/vite/index.test.ts. Onmainit fails because the CSS still contains the@theme { … }block; with this change the output has the:root, :hostdeclaration and the.brandrule.pnpm vitest --root=./integrations run vite/index.test.ts -t 'only uses|production build|demote': 4 passed.prettier --checkon the changed files.