-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Improve upgrade migrations #18184
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
Merged
Merged
Improve upgrade migrations #18184
Conversation
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
Before this, the moment we saw a `(` we stopped trying to convert `bg-[--foo()]` to `bg-(--foo())`. This is because it doesn't make sense to wrap a CSS function in another `var(…)`. However, if that `(` exists in the fallback value, then it's fine and we can still perform the conversion: - `bg-[--my-color,theme(colors.red.500)]` → `bg-(--my-color,theme(colors.red.500))`
+ fix issue when you are using a CSS variable. In that case you do need the `--tw-` prefix for variables defined in the Theme.
RobinMalfait
commented
May 30, 2025
Comment on lines
+196
to
+199
| if (designSystem.theme.prefix) { | ||
| return `--${designSystem.theme.prefix}-${variable.slice(2)}` | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When adding the test to the migrate.test.ts file that runs all the migrations (with variants, prefix, ...) it caught an issue where we didn't handle the --tw- prefix properly when reading from theme values, which is actually necessary when you have a prefix.
thecrypticace
approved these changes
May 30, 2025
RobinMalfait
commented
May 30, 2025
1 task
This was referenced Oct 28, 2025
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 2 issues with the migration tool where certain classes weren't migrated. This PR fixes those 2 scenarios:
Scenario 1
When you have an arbitrary opacity modifier that doesn't use
%, but is just a number typically between0and1then this was not converted to the bare value equivalent before.E.g.:
Will now be converted to:
Scenario 2
Fixes a bug when a CSS function was used in a fallback value in the CSS variable shorthand syntax. In that case we didn't migrate the class to the new syntax.
This was because we assumed that a
(was found, that we are dealing with a CSS function.E.g.:
But if a function was used as a fallback value, for example:
Then we also didn't migrate it, but since the function call is in the fallback, we can still migrate it.
Will now properly be converted to:
Test plan
theme(…)in the fallback also gets updated tovar(…). This one caught an issue because thevar(…)wasn't handling prefixes correctly.