Ensure @config is injected in common ancestor sheet#14989
Merged
Conversation
9491340 to
207183b
Compare
Comment on lines
+1484
to
+1488
| plugins: [ | ||
| () => { | ||
| // custom stuff which is too complicated to migrate to CSS | ||
| }, | ||
| ], |
Contributor
There was a problem hiding this comment.
Suggested change
| plugins: [ | |
| () => { | |
| // custom stuff which is too complicated to migrate to CSS | |
| }, | |
| ], | |
| theme: { | |
| extend: { | |
| colors: { | |
| 'my-red': 'red', | |
| }, | |
| }, | |
| }, |
When we update the config to something that we can convert to, we noticed that the @theme now ends up in src/index.css and that the @config is still inside src/tailwind-setup.css.
Member
Author
Once we found a common parent between two sheets, we can stop finding the parent and continue to the next sheets.
207183b to
36bceb0
Compare
We already computed the correct Tailwind root file (and linked the JS config to it). This means that we can remove the logic in the migrate-config migration to find the correct location.
thecrypticace
approved these changes
Nov 13, 2024
philipp-spiess
approved these changes
Nov 14, 2024
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.
This PR fixes an issue where an
@configwas injected in a strange location if you have multiple CSS files with Tailwind directives.Let's say you have this setup:
In this case,
base.css,components.css, andutilities.cssare all considered Tailwind roots because they contain Tailwind directives or imports.Since there are multiple roots, the nearest common ancestor should become the tailwind root (where
@configis injected). In this case, the nearest common ancestor istailwind-setup.css(notindex.cssbecause that's further away).Before this change, we find the common ancestor between
base.cssandcomponents.csswhich would beindex.cssinstead oftailwind-setup.css.In a next iteration, we compare
index.csswithutilities.cssand find that there is no common ancestor (because theindex.cssfile has no parents). This resulted in the@configbeing injected inindex.cssand inutilities.css.Continuing with the rest of the migrations, we migrate the
index.css's@configaway, but we didn't migrate the@configfromutilities.css.With this PR, we don't even have the
@configin theutilities.cssfile anymore.Test plan
@configis injected in the correct file.@configdoes not exist in theutilities.cssfile (this was the first bug we solved)@configis replaced in thetailwind.cssfile correctly.