-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix CSS theme()
function resolution issue
#14614
Merged
Merged
Conversation
This file contains 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
philipp-spiess
requested review from
RobinMalfait,
adamwathan and
thecrypticace
October 8, 2024 10:01
adamwathan
reviewed
Oct 8, 2024
philipp-spiess
force-pushed
the
fix/theme-function-resolution
branch
from
October 9, 2024 12:33
03b956d
to
0332596
Compare
philipp-spiess
force-pushed
the
fix/theme-function-resolution
branch
from
October 9, 2024 12:58
0332596
to
f6ba774
Compare
thecrypticace
requested changes
Oct 9, 2024
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.
see comment about upgradeToFullPluginSupport
thecrypticace
approved these changes
Oct 10, 2024
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.
We currently have three different implementations of the
resolveThemeValue()
Theme method:@plugin
or@config
is added.Unfortunately, there are some issues with this approach that we've encountered when testing the CSS
theme()
function while upgrading Tailwind Templates to v4 using our upgrading toolkit.theme(spacing.1)
to tuple syntax. Tuples require a nested property access, though, and instead this should be convert totheme(--spacing-1)
.@plugin
or@config
directives are used. It is possible, though, that we need the full compat mapping in other cases as well. One example we encountered istheme(fontWeight.semibold)
which maps to a dictionary in the default theme that that we do not have an equivalent for in v4 variables.To fix both issues, we decided to remove the compat light version of the
theme()
function in favor of adding this behavior to an upgrade codemod. Instead, the second layer now only decides wether it can use the core version or wether it needs to upgrade to the full compat version. Since typos would trigger a hard error, we do not think this has unintended performance consequences if someone wants to use the core version only (they would get an error regardless which they need to fix in order to continue).