heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.38k stars 46 forks source link

added support for sorting variant based classes as well #138

Open tirthGajjar opened 3 years ago

tirthGajjar commented 3 years ago

closes #131

praveenperera commented 3 years ago

Hey @tirthGajjar, thanks for this, looks great. Could you add a test for it?

Also how did you decide on that order?

tirthGajjar commented 3 years ago

@praveenperera Thanks, I will add the test cases.

About the proposed order or variants, Tailwind team suggests specific order when stacking varaints for a single classname, to make everything work. https://tailwindcss.com/docs/configuration#variant-order https://tailwindcss.com/docs/dark-mode#stacking-with-other-variants

I just used this order to sort multiple classes, plus it looked a little more organized.

praveenperera commented 3 years ago

Sounds good, there is also an empty variant in the master branch file should we add that too? https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/defaultConfig.stub.js#L807-L823

Also does this sort stacked variants or just based on the first variant? I think it would be okay to just sort on the first variant.

tirthGajjar commented 3 years ago

Yes, It sorts based on the stacked variants. Sure I will make the final changes and update in 2 days.

danestves commented 3 years ago

Any updates about this?