tailwind_formatter icon indicating copy to clipboard operation
tailwind_formatter copied to clipboard

Remove surrounding spaces

Open zimt28 opened this issue 2 years ago • 1 comments

The formatter currently seems to reduce multiple spaces to single spaces but keeps the first and last space, these should be removed.

"   grid hidden     h-96 grid-cols-4  "  currently becomes
" grid hidden h-96 grid-cols-4 "         instead of
"grid hidden h-96 grid-cols-4"

zimt28 avatar Nov 01 '23 11:11 zimt28

The current context behind this decision is that it seemed complicated to determine whether a string needs padding or not, i.e. {"h-6 " <> if true, do: "bg-white"} – a trailing space here is needed in order to keep the classes separate

Currently the user can delete/add trailing/leading spaces, instead of causing issues such as the above, where we remove the trailing space and have it ultimately render as h-6bg-white

If we could map out all of the cases of when we need to add/remove whitespace, it would be cool I agree. Just easier to keep the current default so the formatter doesn't step on anyone's toes 🙂

100phlecs avatar Nov 01 '23 20:11 100phlecs