Group Custom Classes, Utilities, and Variants Near Related Tailwind Classes When Using Prettier Plugin #18599
-
Hi, I'm using the Prettier plugin for Tailwind CSS, and I'm running into an issue where all my custom classes, utilities, and variants are being sorted to the top after formatting. What I'd like instead is to have them appear next to related core classes. For example: A custom padding utility like A custom variant like A full custom class like Is there a way to control the sorting behavior of the plugin to group custom values near similar Tailwind classes/variants? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
Sorting of utilities happens based on the properties being used, so your For variants, we keep the internal order, custom defined variants will be sorted at the end. |
Beta Was this translation helpful? Give feedback.
Sorting of utilities happens based on the properties being used, so your
pad-custom
andflex-center
should already be close to the padding utilities and flex utilities. E.g.: https://play.tailwindcss.com/BQmGf20sOBFor variants, we keep the internal order, custom defined variants will be sorted at the end.