You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

vite-plugin-html

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
v

vite-plugin-html

A plugin for vite to Minimize index.html and use lodash.template template syntax in index.html

3.2.2
latest
99

Supply Chain Security

100

Vulnerability

67

Quality

77

Maintenance

100

License

Version published
Weekly downloads
326K
1.92%
Maintainers
1
Weekly downloads
 
Created
Issues
91

What is vite-plugin-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.

What are vite-plugin-html's main functionalities?

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'
    })
  ]
});

Other packages similar to vite-plugin-html

FAQs

Package last updated on 17 Jan 2024

Did you know?

Socket

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.

Install

Related posts