Prettier plugin for formatting Go and GoHugo templates. Current stable version 0.0.15, compatible with Prettier ^3.0.0. Requires Node >=14. Automatically formats .gohtml, .gotmpl, .go.tmpl, .tmpl, .tpl, .html.tmpl files. Supports bracket spacing option. For .html files, parser override is needed. No other dependencies beyond Prettier. Actively maintained.
npm install prettier-plugin-go-templateNo compatibility data collected yet for this library.
Install and configure the plugin in .prettierrc for Prettier 3+.
Add 'plugins': ['prettier-plugin-go-template'] to .prettierrc.
Add parser override in .prettierrc: overrides [{ files: ['*.html'], options: { parser: 'go-template' } }].Install both prettier and plugin either both globally or both locally.
Run: npm install --save-dev prettier prettier-plugin-go-template
Add 'plugins': ['prettier-plugin-go-template'] to .prettierrc.