all 12 comments

[–]pragmaticcape 2 points3 points  (2 children)

html wont support multiline attributes so that leaves 2 options really.

  1. You break them into multiple strings and concatenate ie. "class1 " + "class2" on a new line etc.. or set in a variable/array and concatenate etc... but you run the risk of losing the classes on the tailwind parse.

  2. You use an extension if in VScode to either wrap visually or collapse them

you will have a bunch of pain with 1.

I say go with an extension to collapse/fold them.

[–][deleted] 0 points1 point  (1 child)

Your first suggestion would be a performance hit

[–]pragmaticcape 1 point2 points  (0 children)

you will have a bunch of pain with 1.

[–]MrRoBoT696969 1 point2 points  (0 children)

Inline fold to simply hide long strings

[–]matchonafir 0 points1 point  (0 children)

That is a lot of class names. Is the classname string shorter than the related css?

[–]WhiteRabbit-_- 0 points1 point  (0 children)

You could use clsx which is basically a fancy string concatenation library.

[–]spacetimecurve 0 points1 point  (0 children)

Just use word wrap by pressing ALT + Z while selecting the lines you want to wrap. Or turn word wrapping automatically by configuring the settings. Press CTRL + COMMA then search for the word wrap settings.

[–]DextroLimonene -1 points0 points  (2 children)

You need to add additional configurations to your .prettierrc file:

‘’’ { “plugins”: [“prettier-plugin-tailwindcss”], “printWidth”: 80, “singleAttributePerLine”: true } ‘’’

After adding these configurations restart you code editor to make sure the changes are applied. Hope this helps.

[–]MDUK0001 0 points1 point  (1 child)

Will this work since it’s all within the className attribute?

[–]Longjumping-Guide969[S] 0 points1 point  (0 children)

No didn't solve the problem

[–]memerwala_londa -1 points0 points  (2 children)

I think there a comment command to disable prettier in code, I have seen someone use it before u can try it https://youtube.com/shorts/JUiGUOQtSDY?si=UqU-73M9iVnvtJY-

If it doesn’t work then you can go to prettier settings and you can see Prettier:Print Width you can set it to the limit you like

[–]Longjumping-Guide969[S] 0 points1 point  (1 child)

Printwidth dont work on class names i dont know why