Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-webpack-plugin

Package Overview
Dependencies
Maintainers
4
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-webpack-plugin

Simplifies creation of HTML files to serve your webpack bundles

  • 4.0.0-beta.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12M
increased by2.51%
Maintainers
4
Weekly downloads
 
Created

What is html-webpack-plugin?

The html-webpack-plugin is a plugin for webpack that simplifies the creation of HTML files to serve your webpack bundles. It is especially useful for webpack bundles that include a hash in the filename which changes every compilation. You can let the plugin generate an HTML file for you, include your webpack bundles in the file, or generate multiple HTML files with different configurations.

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

Generating a default HTML file

This feature automatically generates a default HTML file that includes all your webpack bundles.

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  plugins: [new HtmlWebpackPlugin()]
};

Custom template

This feature allows you to provide a custom HTML template for the generated file.

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  plugins: [
    new HtmlWebpackPlugin({
      template: 'src/index.html'
    })
  ]
};

Injecting assets

This feature automatically injects all necessary webpack bundles into the HTML file.

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  plugins: [
    new HtmlWebpackPlugin({
      inject: true
    })
  ]
};

Generating multiple HTML files

This feature allows you to generate multiple HTML files with different names and templates.

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  plugins: [
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'src/index.html'
    }),
    new HtmlWebpackPlugin({
      filename: 'about.html',
      template: 'src/about.html'
    })
  ]
};

Other packages similar to html-webpack-plugin

Keywords

FAQs

Package last updated on 18 Jul 2019

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