@hugomods/prettier-config
v0.1.2
Published
Prettier config for Hugo
Downloads
177
Readme
HugoMods Prettier Config
This is a Prettier config for Hugo to format HTML templates, Markdown files, data files, i18n files and so on.
Installation
npm i -D @hugomods/prettier-config
Configuration
Configure the following settings on package.json
.
{
"prettier": "@hugomods/prettier-config",
"scripts": {
"lint:prettier": "prettier **/*.html i18n/* data/* **/*.md --check",
"lint:prettier:fix": "prettier **/*.html i18n/* data/* **/*.md -w",
}
}
Tweak
**/*.html i18n/* data/* **/*.md
to match files that need to formated.
Scripts
Check If Files Is Formatted Correctly
npm run lint:prettier
Format Files In Place
npm run lint:prettier:fix
GitHub Actions
To check if files are formatted correctly via GitHub Actions, you can create a workflow as follows, takes .github/workflows/lint.yml
as an example.
name: lint
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint:prettier