fix: resolve bare CSS @import specifiers in Tailwind CSS v4#23581
Draft
mcollovati wants to merge 2 commits intomainfrom
Draft
fix: resolve bare CSS @import specifiers in Tailwind CSS v4#23581mcollovati wants to merge 2 commits intomainfrom
@import specifiers in Tailwind CSS v4#23581mcollovati wants to merge 2 commits intomainfrom
Conversation
Tailwind CSS v4's Vite plugin fails to resolve bare `@import` specifiers (e.g. `@import "other.css"` without `./`) in CSS files located within project static asset folders. Add a Vite plugin that hooks into Tailwind's `__tw_resolve` to resolve bare CSS specifiers by checking if the importing file is inside a known static asset folder and resolving the specifier relative to that location. Add integration test in test-tailwindcss that verifies a bare `@import` inside a `@CssImport`-referenced CSS file resolves correctly when processed through the Tailwind CSS pipeline. Fixes #23560
|
caalador
reviewed
Feb 24, 2026
Comment on lines
+599
to
600
| bareCssImportResolver(), | ||
| //#tailwindcssVitePlugin# |
Contributor
There was a problem hiding this comment.
If we would ad this fix then the baseCssImportResolver() should probably be added in the replacement of //#tailwindcssVitePlugin# instead of always being there.
Collaborator
Author
There was a problem hiding this comment.
Yeah, it makes sense.
I did it previously, but the Java task class had some awful code to preserve indentation, like hard-coded spaces.
It can probably be done in a better way, by using a regex or by reading the whole placeholder line before replacement.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Tailwind CSS v4's Vite plugin fails to resolve bare
@importspecifiers (e.g.@import "other.css"without./) in CSS files located within project static asset folders. Add a Vite plugin that hooks into Tailwind's__tw_resolveto resolve bare CSS specifiers by checking if the importing file is inside a known static asset folder and resolving the specifier relative to that location.Add integration test in test-tailwindcss that verifies a bare
@importinside a@CssImport-referenced CSS file resolves correctly when processed through the Tailwind CSS pipeline.Fixes #23560