Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
vite-plugin-html
Advanced tools
A plugin for vite to Minimize index.html and use lodash.template template syntax in index.html
vite-plugin-html is a plugin for Vite that allows you to inject data into your HTML files, modify HTML templates, and perform other HTML-related tasks during the build process.
Inject Data into HTML
This feature allows you to inject data into your HTML templates. In this example, the title and description are injected into the HTML file.
import { defineConfig } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
export default defineConfig({
plugins: [
createHtmlPlugin({
inject: {
data: {
title: 'My Vite App',
description: 'This is a description for my Vite app.'
}
}
})
]
});
Minify HTML
This feature enables HTML minification during the build process. Setting `minify` to true will minify the HTML output.
import { defineConfig } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
export default defineConfig({
plugins: [
createHtmlPlugin({
minify: true
})
]
});
Custom HTML Template
This feature allows you to specify a custom HTML template file. In this example, the custom template located at `src/custom-template.html` is used.
import { defineConfig } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
export default defineConfig({
plugins: [
createHtmlPlugin({
template: 'src/custom-template.html'
})
]
});
html-webpack-plugin is a popular plugin for Webpack that simplifies the creation of HTML files to serve your bundles. It offers similar functionalities such as injecting data, minifying HTML, and using custom templates. However, it is designed specifically for Webpack, whereas vite-plugin-html is tailored for Vite.
rollup-plugin-html is a plugin for Rollup that allows you to import HTML files as strings and perform various HTML manipulations. While it provides some similar functionalities like injecting data and using custom templates, it is designed for Rollup rather than Vite.
FAQs
A plugin for vite to Minimize index.html and use lodash.template template syntax in index.html
The npm package vite-plugin-html receives a total of 202,547 weekly downloads. As such, vite-plugin-html popularity was classified as popular.
We found that vite-plugin-html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.