Need help with html-webpack-harddisk-plugin?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

jantimon
214 Stars 40 Forks MIT License 28 Commits 1 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 5,543
JavaScr...
html-we...
Webpack
Less
15 commits
# 622,497
JavaScr...
1 commit
# 86,232
webpack...
CSS
HTML
html-we...
1 commit
# 273
TypeScr...
Webpack
Storybo...
React N...
1 commit
# 382,721
Algolia
TypeScr...
jax-rs
combobo...
1 commit
# 632,399
JavaScr...
1 commit
# 212,952
anki-ad...
flowtyp...
Haskell
Ada
1 commit
# 424,901
JavaScr...
1 commit
# 303,322
steam
HTML
TypeScr...
Jupyter...
1 commit
# 79,021
TypeScr...
HTML
jQuery
flash
1 commit
# 643,540
TypeScr...
JavaScr...
ui-rout...
React
1 commit

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:

shell
$ 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.
javascript
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')
})

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.