
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
vite-plugin-html
Advanced tools
A plugin for vite to Minimize index.html and use lodash.template template syntax in index.html
Supply Chain Security
Vulnerability
Quality
Maintenance
License
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 264,343 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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.