📄 tailwindcss/blog/2024-05-30-prettier-plugin-collapse-whitespace

File: 2024-05-30-prettier-plugin-collapse-whitespace.md | Updated: 11/15/2025

Source: https://tailwindcss.com/blog/2024-05-30-prettier-plugin-collapse-whitespace

v4.1

⌘KCtrl KDocs Blog Showcase Sponsor Plus

May 31, 2024

Automatically clean up whitespace and duplicate class names

Adam Wathan

@adamwathan

Catalyst application layout preview

We just released a new version of prettier-plugin-tailwindcss which adds support for removing unnecessary whitespace and duplicate classes when sorting.


Cleaning up unnecessary whitespace


When you're copying around class names or deleting a class name from the middle of a list, it's easy to end up with some extra whitespace that needs to be cleaned up.

Now our Prettier plugin will handle this for you automatically, so you don't need to clean it up yourself.


Removing duplicate classes


Our VS Code extension has warned you about duplicate class names for a long time, but now our Prettier plugin can remove those duplicate classes for you automatically.


To start playing with these improvements in your own projects, just install the latest version:

npm i prettier-plugin-tailwindcss@latest

If you run into any issues, let us know on GitHub !

Get all of our updates directly to your inbox.
Sign up for our newsletter.

Subscribe

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy