When using TailwindCSS, the className
field easily stretches on the right, making it hard to read and edit.
Here is an example:
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
A part of this most likely won’t be visible if you have two windows on your editor.
Is there a VSCode or a CLI tool to indent this and improve readability?
Thanks!
2
Answers
Yes, In VS code just press
Alt + Z
basically its word wrapor
In VC code, go to view there you enable word wrap
Like Margin > Width / Height > Border > Padding etc…
Many people don’t like next step but from time to time you can see people keep long class / style list in vertical layout
In my opinion its way better for long elements to read classes but also cost a few bytes, and it make you see less of code at same time.
Worst way would be mix it like:
Imo. its worst cause some lines can get wraped if they are too long and it would mess hierarchy.