Replies: 41 comments 40 replies
-
I dig the idea of removing duplicate classes! 👍 However, Prettier should already take care of extra spaces. I just gave this a try: <!-- Before -->
<header class=" bg-grey-200 md:flex hidden ">
<!-- After -->
<header class="hidden bg-grey-200 md:flex"> |
Beta Was this translation helpful? Give feedback.
-
Hmm, just realizing that while it does it for the <!-- Before -->
<header :class="` bg-grey-200 md:flex hidden `">
<!-- After -->
<header :class="` hidden bg-grey-200 md:flex `"> So, I suspect it probably also won't work with some other variations like |
Beta Was this translation helpful? Give feedback.
-
@reinink I can confirm it doesn't remove extra spaces for |
Beta Was this translation helpful? Give feedback.
-
will this feature be implemented in next releases? |
Beta Was this translation helpful? Give feedback.
-
It doesn't remove the spaces in svelte with |
Beta Was this translation helpful? Give feedback.
-
But yes, please remove duplicate classes from |
Beta Was this translation helpful? Give feedback.
-
Not only spaces but line breaks also should be removed |
Beta Was this translation helpful? Give feedback.
-
+1 for removing duplicates 😄 |
Beta Was this translation helpful? Give feedback.
-
Any progress on this? I'd be keen to help out if needed. |
Beta Was this translation helpful? Give feedback.
-
I would like to see extra whitespace be removed |
Beta Was this translation helpful? Give feedback.
-
Would like to see this too |
Beta Was this translation helpful? Give feedback.
-
I raised a PR trying to fix it. Feel free to review and comment. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I think that both removing duplicates and white-space is a great feature that I hope can be included at some point! |
Beta Was this translation helpful? Give feedback.
-
I've built lots of my classes dynamically, so I seem to be missing out on a lot of fun import { ParentComponent, onCleanup } from 'solid-js';
//types of button
export enum ButtonType {
Pagination,
Action,
}
//todo decide common things like font size and font weight from the DS
export const O_Button: ParentComponent<{ buttonType: ButtonType }> = (props) => {
const buttonType = props.buttonType;
const className =
buttonType === ButtonType.Pagination
? ' px-4 py-[10px] text-sm font-medium hover:border-primary-300 hover:bg-primary-50 active:border-primary-300 active:bg-primary-50 rounded-none border-[0.5px] hover:border max-[425px]:px-[.5rem]'
: '';
return <button class={` ${className}`}>{props.children}</button>;
}; |
Beta Was this translation helpful? Give feedback.
-
I hope the feature to remove unnecessary whitespace will be added. I looked for this feature everywhere for over a year now. |
Beta Was this translation helpful? Give feedback.
-
any update on the whitespace thing ?? |
Beta Was this translation helpful? Give feedback.
-
Just started a new project and I thought I was going crazy trying to debug my config, since this worked in the past. It would be lovely to have whitespace trimmed when formatting. |
Beta Was this translation helpful? Give feedback.
-
+1 for whitespace |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
+1 for removing whitespace |
Beta Was this translation helpful? Give feedback.
-
We absolutely need this :) This plugin which already re-writes the className content, is the right place to remove the extra spaces on the fly. I'm surprised that's not a native feature. Meanwhile, https://www.npmjs.com/package/@softonus/prettier-plugin-whitespace-remover does the trick (but we'd rather rely on 1 plugin rather than 2). EDIT: the aforementioned plugin does not work with Tailwind's prettier plugin, when we set both of them. Only 1 of them operates. So we'd have to choose between having the classes sorted, or no white-space, which sucks a bit. |
Beta Was this translation helpful? Give feedback.
-
Two existing plugins can remove duplicates and whitespace. Here is the issue: #13708
The problem is that they need to come before prettier-plugin-tailwindcss in order for them to work. Until then, you can simply patch prettier-plugin-tailwindcss inside your project. |
Beta Was this translation helpful? Give feedback.
-
For those who want the whitespace and duplicate remover today, you can patch Here are the instructions: #13708 (comment) The maintainers of the awesome Till then, happy patching away! |
Beta Was this translation helpful? Give feedback.
-
Tailwind folks have the final say! |
Beta Was this translation helpful? Give feedback.
-
Workaround (use
|
Beta Was this translation helpful? Give feedback.
-
@karlhorky I am looking forward to a fix in the official plugin. If possible raise a PR here as well. |
Beta Was this translation helpful? Give feedback.
-
We're working on this right now actually :) Hope to have a PR open tomorrow. I've run into some edge cases that need to be addressed before we can. |
Beta Was this translation helpful? Give feedback.
-
Support for this has been released in v0.6.0 and it's on by default!
|
Beta Was this translation helpful? Give feedback.
-
Awesome work on this plugin! The only thing Headwind is doing that's currently missing is also removing duplicate class names and extra spaces. Would be a nice addition.
Beta Was this translation helpful? Give feedback.
All reactions