-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Change how we handle defaults (optimized or not) #6926
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
# Conflicts: # CHANGELOG.md # tests/apply.test.js
thecrypticace
force-pushed
the
fix/enable-optimize-universal-defaults
branch
from
January 7, 2022 15:37
5407159
to
f1f6ea2
Compare
# Conflicts: # CHANGELOG.md # tests/apply.test.js
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.
What's changing
Only emit defaults when using base layer
The always-on defaults layer has now been removed. It was a good idea in theory but in practice it has become a source of issues and is a maintenance burden. It has been moved back to being included with the base layer.
As a result of this you must include
@tailwind base
to get default variables.Emit plugin defaults regardless of usage
The previous behavior was to only emit defaults for used utilities. We now emit defaults for every core plugin / utility regardless of it's usage. This is a minor increase in file size but results in a more consistent and predictable behavior across the board for different users of tailwind.
Optimize universal defaults no longer works without
@tailwind base
This was the original behavior of optimize universal defaults. It was changed in an attempt to work with isolated CSS modules. This was however a bit of a hack. The problem is that we can't necessarily know how user's are using CSS modules – either with
@tailwind base
or without because they're compiled in isolation without knowledge of any other files used.Our recommendation for users of CSS modules is the following:
experimental.optimizeUniversalDefaults
@tailwind base
.The default border color has been moved back to preflight
The border color plugin was previously changed to move the default border color from preflight to the border color plugin. This was a reasonable idea but meant that disabling preflight still produced a default border color which can be unexpected (like in #6923).
Default borders no longer work with the legacy
border-opacity-*
utilitiesThese utilities have been deprecated since we released v3. They still "work" but are discouraged. We suggest you use the new
border-{color}/{opacity}
modifiers introduced in v3.0 instead. For example the followingborder border-opacity-25
becomesborder border-gray-200/25
.Removes variable reads from defaults
We had defaults like
--tw-transform
whose only real purpose was to make the usage of the utilities smaller. However this has some performance implications in Safari and have removed them in attempt to fix it. As a nice side effect it also makes the list of defaults look much cleaner.Am I affected?
You should only be affected by this change if one of the following is true:
@tailwind base
layerborder-opacity-25
utilities on default border colors.optimizeUniversalDefaults
flag. Note that experimental features are subject to change at any time.