【问题标题】:VSCODE rearanges html classNamesVSCODE 重新排列 html 类名
【发布时间】:2022-10-25 15:08:16
【问题描述】:

我的 VSCODE(可能更漂亮)改变了我给 HTML 元素的类名。例如,这个类名: <a className="border-green-300 rounded mr-2 border-b-2 "> 变成这样:

<a className="m-5 rounded-lg border-b-2 border-green-300"> 这很烦人,因为我有时会检查我的第二个屏幕以查看设置的结果(我使用 TailwindCSS),如果我不喜欢某些东西,我会快速删除它,但由于它已经重新排列,我只是删除了另一个类。有设置禁用此功能吗?我找不到它了。

【问题讨论】:

  • 看起来您可能安装了prettier-plugin-tailwindcss,它会自动对类进行排序:tailwindcss.com/blog/automatic-class-sorting-with-prettier。你试过卸载它吗?
  • 我绝对不是自己安装的,也许它是另外安装的。我尝试使用“npm uninstall -g prettier prettier-plugin-tailwindcss”卸载它,这可能是错误的。我该怎么做?我在我的扩展中也找不到它,我那里只有 Tailwind Intelisense。
  • 您确定它也没有在您的顺风配置文件中配置吗?
  • 知道了!非常感谢,我正在寻找更漂亮的设置而不是顺风设置!
  • @Clytax 它是什么设置?

标签: html css visual-studio-code tailwind-css prettier


【解决方案1】:

该插件将尊重您的 tailwind.config.js 文件并与您安装的任何 Tailwind 插件一起使用,但无法更改排序顺序。就像 Prettier 一样,我们认为自动格式化的好处将很快超过您拥有的任何风格偏好,并且您会很快习惯它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-07
    • 2020-03-12
    • 2012-01-11
    • 2021-12-26
    • 2021-09-30
    相关资源
    最近更新 更多