A Vite plugin for HTML processing that provides EJS templating, HTML minification, and multi-page application support. Version 1.0.5, actively maintained with recent fixes. It is a fork and alternative to the stalled vite-plugin-html, aiming to address bugs and unmerged PRs. Key differentiators: EJS templates, flexible entry/template configuration, and inject tags with precise placement control.
npm install vite-plugin-htmlxVerified import paths — ran on the pinned version, not inferred.
Sets up vite-plugin-htmlx with HTML minification and EJS template data injection for a single-page app.
Upgrade Vite to 4.0.0 or later.
Use 'import html from 'vite-plugin-htmlx'' or 'import { createHtmlPlugin } from 'vite-plugin-htmlx''.For single page, use 'page: {...}'. For multi-page, use 'page: [{...}, ...]'.Use default import 'import html from 'vite-plugin-htmlx'' instead.
Always set explicit 'filename' for each MPA page entry.
Ensure 'template' path in page config points to an existing HTML file, e.g., 'public/index.html'.
Provide unique 'filename' for each MPA page entry, e.g., 'index.html', 'other.html'.
Set minify: true or provide valid MinifyOptions object.