stivoat/tailwind-fold

Ability to hide classes defined using curly braces

Closed this issue · 2 comments

Sometimes we have to define classes using curly braces instead of just quotes when we have to merge some classes that are conditionally rendered. For example:

className={`some class here ${some condition based class here}`}
OR
className={cn(
               "some class here",
               some condition based class here
            )}

The first one works randomly. I think if there are lots of classes and the prettier has moved the ending bracket to next line, the extension fails to fold.

example:
image

Etsi0 commented

+1
it would be nice if they could make it fold into something like this:

className={...}
Etsi0 commented

i think this would fix it:

/(class|className)=(['"`]|{)(.*?)(\2|})/g