@hugomods/prettier-config
v0.2.0
Published
Prettier config for Hugo
Downloads
334
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 . --check",
"lint:prettier:fix": "prettier . -w"
}
}
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