-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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" ```
- Loading branch information
Showing
3 changed files
with
150 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
const TAILWIND_PSEUDO_CLASSES = [ | ||
'hover', | ||
'focus', | ||
'focus-within', | ||
'focus-visible', | ||
'active', | ||
'visited', | ||
'target', | ||
'first', | ||
'last', | ||
'only', | ||
'odd', | ||
'even', | ||
'first-of-type', | ||
'last-of-type', | ||
'only-of-type', | ||
'empty', | ||
'disabled', | ||
'checked', | ||
'indeterminate', | ||
'default', | ||
'required', | ||
'valid', | ||
'invalid', | ||
'in-range', | ||
'out-of-range', | ||
'placeholder-shown', | ||
'autofill', | ||
'read-only' | ||
] | ||
|
||
const TAILWIND_PSEUDO_ELEMENTS = [ | ||
'before', | ||
'after', | ||
'placeholder', | ||
'file', | ||
'marker', | ||
'selection', | ||
'first-line', | ||
'first-letter' | ||
] | ||
|
||
const TAILWIND_RESPONSIVE_BREAKPOINTS = [ | ||
'sm', | ||
'md', | ||
'lg', | ||
'xl', | ||
'2xl' | ||
] | ||
|
||
const TAILWIND_MEDIA_QUERIES = [ | ||
'dark', | ||
'motion-reduce', | ||
'motion-safe', | ||
'portrait', | ||
'landscape', | ||
'print' | ||
] | ||
|
||
const TAILWIND_OTHER_MODIFIERS = [ | ||
'ltr', | ||
'rtl', | ||
'open' | ||
] | ||
|
||
export const TAILWIND_MODIFIERS = [ | ||
...TAILWIND_PSEUDO_CLASSES, | ||
...TAILWIND_PSEUDO_ELEMENTS, | ||
...TAILWIND_RESPONSIVE_BREAKPOINTS, | ||
...TAILWIND_MEDIA_QUERIES, | ||
...TAILWIND_OTHER_MODIFIERS | ||
] | ||
|
||
export default TAILWIND_MODIFIERS; |
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