自动清理空格和重复的类名

Adam Wathan
Catalyst application layout preview

我们刚刚发布了 prettier-plugin-tailwindcss 的新版本,它增加了在排序时删除不必要空格和重复类的支持。

¥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)

¥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.

现在我们的 Prettier 插件会自动为你处理这个问题,所以你无需自己清理。

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


删除重复的类(Removing duplicate classes)

¥Removing duplicate classes

我们的 VS Code 扩展 长期以来一直警告你有关重复的类名,但现在我们的 Prettier 插件可以自动为你删除这些重复的类。

¥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

如果你遇到任何问题,请在 GitHub 上告诉我们!

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

TailwindCSS v4.1 中文网 - 粤ICP备13048890号