astro-html-validate
v1.0.1
Published
Astro integration that validates generated HTML with html-validate.
Maintainers
Readme
astro-html-validate
Validate generated Astro HTML with html-validate during astro build.
This integration uses your existing html-validate configuration (for example .htmlvalidate.json).
Installation
# Astro CLI (recommended)
pnpm astro add astro-html-validate
# pick one
pnpm add -D astro-html-validate html-validate
npm install -D astro-html-validate html-validate
yarn add -D astro-html-validate html-validateUsage
// astro.config.mjs
import { defineConfig } from "astro/config";
import htmlValidate from "astro-html-validate";
export default defineConfig({
integrations: [
htmlValidate({
patterns: ["**/*.html"],
formatter: "text",
failOnWarning: false,
allowEmpty: true,
}),
],
});Options
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| patterns | string \| string[] | ['**/*.html'] | File globs to validate, relative to Astro output directory. |
| formatter | string | 'text' | html-validate formatter to use for console output. |
| failOnWarning | boolean | false | Fail build when warnings are present. |
| allowEmpty | boolean | true | If no files match, warn instead of failing. |
How config is resolved
html-validate auto-discovers configuration from your project root and file paths, so your existing .htmlvalidate.* config will be applied to build output.
Development
pnpm install
pnpm run lint
pnpm run buildCommit Conventions
This repository enforces Conventional Commits with commitlint in CI and a local Husky commit-msg hook.
Examples:
feat: add formatter option docsfix: handle empty output dir warningfeat!: rename integration option
Releases
Releases are automated with semantic-release from main.
Version bump rules:
fix:=> patchfeat:=> minor!orBREAKING CHANGE:=> major
Local checks before merging:
pnpm run check:release
pnpm run release:dry-runLicense
MIT
