Resolve tailwindcss relative to the file being processed#386
Merged
thecrypticace merged 15 commits intomainfrom Aug 29, 2025
Merged
Resolve tailwindcss relative to the file being processed#386thecrypticace merged 15 commits intomainfrom
tailwindcss relative to the file being processed#386thecrypticace merged 15 commits intomainfrom
Conversation
5253d6e to
a14691d
Compare
a14691d to
e07af2e
Compare
Member
RobinMalfait
left a comment
There was a problem hiding this comment.
Looking good, a few small questions/suggestions.
The src/config.ts file reads very nicely right now.
I think technically this change could be a breaking change, but for people with simple setups looking for tailwindcss from the config or input file shouldn't result in any differences. But for people with a more complex (monorepo) setup it should solve locating tailwindcss correctly.
Running into some issues with this PR, let's discuss this on Tuple later 👍
The last release was over 5 years ago
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
f7fc236 to
827e5f2
Compare
RobinMalfait
approved these changes
Aug 29, 2025
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.
Breaking change
tailwindcssis now resolved relative to each processed fileLoading the
tailwindcssversion relative to each processed file produces more correct behavior for monorepos wheretailwindcssmay not be installed at the project root but instead in a subdirectory. Because of this projects with multiple Tailwind CSS versions in the same repo are also more likely to work than before.Automatically loaded v3 configs are resolved relative to each processed file
Similar to the above, the same happens when we automatically locate your v3-style config files. Previously these were always searched for relative to the Prettier config — this often meant the file needed to be in the project root. This is no longer the case which should improve support for monorepos with multiple configs using Tailwind CSS v3.
This ended up turning into a complete rework of the module and config loading. There's definitely going to be some different perf characteristics because some things are loaded relative to an input file now but it's hopefully minimal.
Will need to do lots of perf testing on a large codebase — esp with lots of embedded languages/expressions (e.g. large Vue files).
Closes #243 (since the implementation is now entirely different but does the same thing)
Fixes #340
Closes #361
Closes #363
Closes #369