Add sorting for modifier classes (focus:, md:...)#180
Open
phacks wants to merge 1 commit intoheybourn:masterfrom
Open
Add sorting for modifier classes (focus:, md:...)#180phacks wants to merge 1 commit intoheybourn:masterfrom
focus:, md:...)#180phacks wants to merge 1 commit intoheybourn:masterfrom
Conversation
This commit adds sorting for Tailwind modifier classes: `md:w-12`, `hover:bg-gray-500`... The sort is as follows: - Modifier classes are added after non-modifier classes, but before customClasses if those are appended - For a given modifier (e.g. `md:`), the sort is the same as `sortOrder` - Modifiers are sorted among one another in the order they appear in the Tailwind documentation Example: ```javascript // Input: "xl:mx-6 bg-gray-100 lg:mx-4 mt-1 sm:bg-gray-200 hover:bg-blue-100 lg:bg-gray-400 hover:text-blue-100 xl:bg-gray-600 sm:mx-2" // Output: "mt-1 bg-gray-100 hover:text-blue-100 hover:bg-blue-100 sm:mx-2 sm:bg-gray-200 lg:mx-4 lg:bg-gray-400 xl:mx-6 xl:bg-gray-600" ```
|
Hi. How is it going? Looks like the test has been failed. |
904518e to
c27b25a
Compare
Author
|
oops! Done! |
|
Any word on a merge for this? Edit: actually I gave it a try and it doesn't seem to work: <View className='lg:text-black sm:text-black xl:text-black dark:bg-black flex-1 text-black bg-white'>We would want the modifiers after the base classes |
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
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.
Hey everyone! This PR adds sorting for Tailwind modifier classes:
md:w-12,hover:bg-gray-500...The sort is as follows:
customClasses if those are appended
md:), the sort is the same assortOrderTailwind documentation.
This PR does not introduce all possible variations of all possible classes, but instead does the following:
sortOrderExample:
Closes #52, #104 and #142.
I’m not sure whether we should make the order of modifier classes, or modified vs. non-modified classes customizable. I’d suggest tackling this in a subsequent PR should we want to!