Skip to content
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

Ensure variants are grouped properly for plugins with order-dependent utilities #4273

Merged
merged 1 commit into from May 7, 2021

Conversation

@adamwathan
Copy link
Contributor

@adamwathan adamwathan commented May 7, 2021

Fixes #4038.

Prior to this we were using multiple addUtilities calls within one plugin sometimes to make sure that certain things were guaranteed to be in a certain order in JIT mode. It turns out that wasn't even necessary because we were already counting each utility in every addUtilities call toward the total sort count, not just counting the addUtilities calls themselves.

This PR collapses anywhere where we had multiple calls, as multiple calls were resulting in variants for the first call showing up in the output before non-variant utilities for subsequent calls.

Before:

.block {
  display: block
}

@media (prefers-color-scheme: dark) {
  .dark\:block {
    display: block;
  }
}

.hidden {
  display: none;
}

After:

.block {
  display: block
}

.hidden {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .dark\:block {
    display: block;
  }
}
@codecov-commenter
Copy link

@codecov-commenter codecov-commenter commented May 7, 2021

Codecov Report

Merging #4273 (7eac48a) into master (e399c5f) will increase coverage by 0.02%.
The diff coverage is n/a.

Current head 7eac48a differs from pull request most recent head 82c61ed. Consider uploading reports for the commit 82c61ed to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4273      +/-   ##
==========================================
+ Coverage   71.17%   71.19%   +0.02%     
==========================================
  Files         218      218              
  Lines        4721     4715       -6     
  Branches      776      776              
==========================================
- Hits         3360     3357       -3     
+ Misses       1274     1271       -3     
  Partials       87       87              
Impacted Files Coverage Δ
src/plugins/display.js 50.00% <ø> (ø)
src/plugins/fontVariantNumeric.js 50.00% <ø> (ø)
src/plugins/textOverflow.js 50.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e399c5f...82c61ed. Read the comment docs.

@adamwathan adamwathan merged commit bd84d2f into master May 7, 2021
2 checks passed
2 checks passed
@github-actions
build (12.x)
Details
@github-actions
build (14.x)
Details
@adamwathan adamwathan deleted the fix-variant-grouping branch May 7, 2021
adamwathan added a commit that referenced this pull request May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants