-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort classes deep inside clsx
calls
#14
Comments
You're right! I didn't consider this.. I'll look into implementing this soon! |
Awesome, I love how fast you're delivering improvements 🙌 |
Yeah, run into this too! I think there was a wrong assumption that we're only talking about JSX attributes. It would be nice to be able to sort any function calls, just like @kripod proposed 😄 |
Classes inside arrays passed as an argument are also not sorted. An example: const zz = cx(['flex-col flex']); // flex should come before flex-col
const yy = (<div tw={['flex-col flex']}>Hey There!</div>); |
Another case where the classes isn't sorted is if you use clsx to "structure" the classes, i.e. printing each class on a separate row: <div
className={clsx(
'flex-col',
'max-w-[768px]',
'w-full',
'flex',
'items-center',
'py-20',
'lg:py-60'
)}
>
</div> |
#11 was implemented recently and it works like charm for simple cases. However, it doesn't sort class names within arrays and objects passed to
clsx
(and similar methods). For instance, classes in the following code should be auto-sorted deeply:Thank you in for maintaining this wonderful library! 😊
The text was updated successfully, but these errors were encountered: