-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use amount of properties when sorting (#16715)
Right now we sort the nodes based on a pre-defined sort order based on the properties that are being used. The property sort order is defined in a list we maintain. We also have to make sure that the property count is taken into account such that if all the "sorts" are the same, that we fallback to the property count. Most amount of properties should be first such that we can override it with more specific utilities that have fewer properties. However, if a property doesn't exist, then it wouldn't be included in a list of properties therefore the total count was off. This PR fixes that by counting all the used properties. If a property already exists it is counted twice. E.g.: ```css .foo { color: red; &:hover { color: blue; } } ``` In this case, we have 2 properties, not 1 even though it's the same `color` property. ## Test plan: 1. Updated the tests that are now sorted correctly 2. Added an integration test to make sure that `prose-invert` is defined after the `prose-stone` classes when using the `@tailwindcss/typography` plugin where this problem originated from. Note how in this play (https://play.tailwindcss.com/wt3LYDaljN) the `prose-invert` comes _before_ the `prose-stone` which means that you can't apply the `prose-invert` classes to invert `prose-stone`.
- Loading branch information
1 parent
f8d7623
commit 113142a
Showing
6 changed files
with
120 additions
and
92 deletions.
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.