Skip to main content

Command Palette

Search for a command to run...

Cleanup Whitespace and duplicate classnames in Tailwind using Prettier

Updated
1 min read
Cleanup Whitespace and duplicate classnames in Tailwind using Prettier

Tailwind has released a new version of prettier-plugin-tailwindcss which adds support for removing unecessary whitespaces and duplicate classnames.

Cleaningup unecessary whitespace

When you are copying a classname or deleting a class name from the middle of a list, it's easy to endup with some extraspace that needs to be cleanedup.

Now prettier plugin will handle it automatically.

Removing Duplicate Classes

VS Code will warn us if we use the duplicate classnames using the yellow lines, but now Prettier plugin can remove those duplicate classes automatically.

To start playing with these improvements in your project using the following command

 npm i prettier-plugin-tailwindcss@latest

More from this blog

Nidhin's blog

168 posts

✨Crafting Code with a Smile for 8 Years:) Merging the Formal Dance of Angular, the Playful Rhythms of React, and the Next-level Moves of Next.js 🚀