Hugoプロジェクトでprettierの設定を整える
更新日:2023.07.29
作成日:2023.07.29
インストール
npm install -D --save prettier prettier-plugin-go-template prettier-plugin-tailwindcss
設定ファイル
.prettierrc
ファイルにprettier
の設定を記述する。複数のプラグインも同時に扱えるようだ。
prettier-plugin-go-template
は、Go Templateのためのprettierプラグインprettier-plugin-tailwindcss
は、TailwindCSSのためのprettierプラグイン
{
"plugins": [
"prettier-plugin-go-template",
"prettier-plugin-tailwindcss"
],
"overrides": [
{
"files": [
"*.html"
],
"options": {
"parser": "go-template"
}
}
]
}
保存時に自動的にフォーマットされるようにした。
{
"prettier.requireConfig": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"editor.formatOnSave": true
}
Related contents

2023.07.29
Hugoトピックノート

2023.04.30
Obsidian x Hugo

TECH
2023.02.03
Hugo v0.109.0でパンくずリストをシンプルに実装する

2024.01.05
ObsidianのためにHugoのエイリアス機能を無効化する

TECH
2022.09.03
【Hugo】Render Hooks for Code Blocksを利用してコードブロックにファイル名を表示する

TECH
2022.08.29
Hugoでブログカードを作成する(resources.GetRemote利用)

TECH
2022.08.14
GitHub PagesからCloudflare Pagesへの移行

TECH
2022.06.29
AMP Service WorkerでPrefetch Linksを実現する