-
Notifications
You must be signed in to change notification settings - Fork 189
feat(TailwindCSS): Add support for Tailwind CSS @theme directive customization #22969
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
base: main
Are you sure you want to change the base?
Conversation
Users can now create an optional `frontend/tailwind-custom.css` file to add custom Tailwind CSS directives such as @theme blocks for defining custom theme values. When the custom file exists, it is automatically imported into the generated tailwind.css, allowing users to extend the default Tailwind theme without modifying generated files. Example usage: ```css @theme { --color-my-theme: red; --spacing-custom: 2.5rem; } ``` Changes: - Add #customImport# placeholder in tailwind.css template - Detect and import frontend/tailwind-custom.css if it exists - Add comprehensive unit tests for custom import functionality - Add integration tests with @theme directive example - Fully backward compatible - no changes needed for existing projects Fixes #22914 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Reuse File object in path calculation instead of reconstructing path - Make @source assertion more specific by checking for quoted pattern - Improves code clarity without changing functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Verify that @source directive contains the specific path "../.." instead of just checking for the presence of quotes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Test Results1 255 files - 20 1 255 suites - 20 1h 15m 46s ⏱️ + 5m 39s For more details on these failures, see this check. Results for commit dcc8c9f. ± Comparison against base commit 0d1677c. This pull request removes 451 and adds 80 tests. Note that renamed tests count towards both.This pull request removes 1 skipped test and adds 2 skipped tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
|



Summary
Adds support for Tailwind CSS's
@themedirective by allowing users to create an optionalfrontend/tailwind-custom.cssfile that gets automatically imported into the generatedtailwind.css.Motivation
Fixes #22914
Users want to use Tailwind's
@themedirective to define custom theme values, but the current Tailwind integration doesn't provide a way to add custom directives without modifying generated files.Implementation
When a
frontend/tailwind-custom.cssfile exists, it is automatically imported into the generatedtailwind.cssfile via@importstatement. This allows users to:@themeblocks for defining theme values@importstatementsExample Usage
Create
frontend/tailwind-custom.css:Use in Java components:
Changes
#customImport#placeholder intailwind.csstemplatefrontend/tailwind-custom.cssif it exists inTaskGenerateTailwindCss@themedirective example intest-tailwindcssmoduleBenefits
Testing
@themedirective works in browser🤖 Generated with Claude Code