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

html-webpack-harddisk-plugin

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-webpack-harddisk-plugin

Write html files to hard disk even when using the webpack dev server or middleware

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Harddisk extension for the HTML Webpack Plugin

npm version Dependency Status Build Status js-semistandard-style

Enhances html-webpack-plugin functionality by adding the {alwaysWriteToDisk: true|false} option.

This is an extension plugin for the webpack plugin html-webpack-plugin - a plugin that simplifies the creation of HTML files to serve your webpack bundles.

Installation

You must be running webpack on node 10.x or higher

Install the plugin with npm:

$ npm install --save-dev html-webpack-harddisk-plugin

Basic Usage

Require the plugin in your webpack config:

const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');

Add the plugin to your webpack config as follows:

plugins: [
  new HtmlWebpackPlugin(),
  new HtmlWebpackHarddiskPlugin()
]  

The above configuration will actually do nothing due to the configuration defaults.

As soon as you now set alwaysWriteToDisk to true the generated output of the HtmlWebpackPlugin will always be written to disk. This is very useful if you want to pick up the output with another middleware.

plugins: [
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: true
	}),
  new HtmlWebpackHarddiskPlugin()
]  

Even if you generate multiple files make sure that you add the HtmlWebpackHarddiskPlugin only once:

plugins: [
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: true
	}),
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: true,
		filename: 'demo.html'
	}),
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: false,
		filename: 'test.html'
	}),
  new HtmlWebpackHarddiskPlugin()
]  

If you need to set the output path explicitly (for example when using with webpack-dev-server middleware) then pass in the outputPath option:

new HtmlWebpackHarddiskPlugin({
  outputPath: path.resolve(__dirname, 'views')
})

Keywords

FAQs

Package last updated on 15 Feb 2021

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