tailwindlabs / prettier-plugin-tailwindcss

A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order.
MIT License
5.61k stars 133 forks source link

Whitepace still removed incorrectly for some ternary conditions #305

Open karptonite opened 3 months ago

karptonite commented 3 months ago

What version of prettier-plugin-tailwindcss are you using? v0.6.5

What version of Tailwind CSS are you using? v3.4.4

What version of Node.js are you using? v18.20.4

What package manager are you using? Yarn

What operating system are you using? macOS

Describe your issue

 <ul [class]="'pagination' + (size ? ' pagination-' + size : '')">

in 0.5.3, this code is unchanged. in 0.6.5, it is changed to

 <ul [class]="'pagination' + (size ? 'pagination-' + size : '')">

This was discussed previously in issue #285. It seems like it was fixed in #288, but apparently not in this case.

thecrypticace commented 3 months ago

what templating language is this? Angular?

karptonite commented 3 months ago

Yes, this is Angular.

ziloen commented 3 months ago

Same in template strings

// React
<div className={`text-black${condition ? ' bg-green': ''}`} />

becomes

<div className={`text-black${condition ? 'bg-green': ''}`} />