Sorting Tailwind classes without `prettier-plugin-tailwindcss`
I was wondering if there is any public function or library that is able to take a string or Array<string> of classes and apply the same or similar method used by the plugin.
My use case is for a custom class merger I built. The issue is that the result can't be accessed by the plugin for obvious reasons. I thought I could import whatever functions the plugin uses internally and piggyback off that, but they aren't exposed by the package. Are there any alternatives or workarounds I could use? It's not a big deal at the moment, but it makes me uncomfortable not having all classes sorted.
3 Replies
I know NextUI has the
cn
helper function, but I don't know if that sorts them.Yeah, there lies the issue. As I know my implementation, I know for a fact that I don't sort them, and it's staring me in the face :shame::shame::shame:
Honestly if you want sorted classes, I think this might be a matter of either sucking it up and installing the plugin or manually doing the work to sort things