LoginSignup
0
1

More than 1 year has passed since last update.

VS Code で prettier-plugin-tailwindcss を使う

Posted at

prettier-plugin-tailwindcssをdev-dependencyとしてインストールします。

npm install -D prettier prettier-plugin-tailwindcss

settings.json にフォーマットの設定を追加します。

.vscode/settings.json
{
  "[html]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

ルートディレクトリに prettier.config.js を作成します。

prettier.config.js
module.exports = {
  plugins: [require('prettier-plugin-tailwindcss')],
}

HTML を編集し、

<div class="px-4 bg-sky-700">foo</div>

を保存すると、

<div class="bg-sky-700 px-4">foo</div>

とソートされます。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1