Socket
Socket
Sign inDemoInstall

vite-plugin-html

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-html

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


Version published
Weekly downloads
257K
increased by2.13%
Maintainers
1
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 26 Dec 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc