
A vite plugin for processing html. It is developed based on lodash template
The vite-plugin-html is a plugin for the Vite build tool that provides capabilities for HTML compression and EJS template functionality. It also supports multi-page applications and allows for customization of entry points and templates.
import { UserOptions } from 'vite-plugin-html';
createHtmlPlugin(options: UserOptions)
src/main.ts.index.html.InjectOptions configuration.true or set MinifyOptions for custom configuration.interface InjectOptions {
data: Record<string, any>;
ejsOptions: EJSOptions;
tags: HtmlTagDescriptor[];
}
interface MinifyOptions {
// Custom compression configuration
}
interface PageOption {
filename: string;
template: string;
entry: string;
injectOptions: InjectOptions;
}
Data can be accessed in HTML using the EJS template syntax.
By default, the contents of the .env file will be injected into the index.html file, similar to Vite's loadEnv function.
The vite-plugin-html is a useful plugin for the Vite build tool that adds HTML compression and EJS template functionality. It supports multi-page applications and allows for customization of entry points and templates. With its features and easy installation, it provides developers with greater flexibility in building optimized and dynamic web applications.

Vite is a build tool that aims to provide a faster and leaner development experience for modern web projects
ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.
TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.