Vite plugin that transforms <pug> tags in HTML into compiled Pug templates. Current stable version is 0.4.1, supporting Vite 5. Releases follow no strict cadence; last update (v0.4.1) added Vite 5 support. Key differentiators: supports local variables, multiple pug tags, self-closing tags, hot reload on save, and works with both CJS and ESM. Ships TypeScript declarations. Simpler than alternatives that require Vue SFCs for Pug support.
npm install vite-plugin-pugVerified import paths — ran on the pinned version, not inferred.
Configures Vite to use vite-plugin-pug with Pug pretty-printing option and local variables.
Remove `pretty` from plugin options, or use pug's built-in formatting via beautifier.
Update config: `pugPlugin(options, locals)` instead of `pugPlugin({locals, ...})`.Ensure all pug src paths are relative to the importing HTML file.
Run `npm install -D pug` to add the peer dependency.
Use `import pugPlugin from 'vite-plugin-pug'` (no curly braces).
Run `npm install -D vite-plugin-pug`.