Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

jantimon/html-webpack-harddisk-plugin

Repository files navigation

npm versionDependency StatusBuild Statusjs-semistandard-style

Enhanceshtml-webpack-pluginfunctionality by adding the{alwaysWriteToDisk: true|false} option.

This is an extension plugin for thewebpack pluginhtml-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:

constHtmlWebpackHarddiskPlugin=require('html-webpack-harddisk-plugin');

Add the plugin to your webpack config as follows:

plugins:[newHtmlWebpackPlugin(),newHtmlWebpackHarddiskPlugin()]

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

As soon as you now setalwaysWriteToDisk totrue the generated output of the HtmlWebpackPlugin willalways be written to disk. This is very useful if you want to pick up the output with another middleware.

plugins:[newHtmlWebpackPlugin({alwaysWriteToDisk:true}),newHtmlWebpackHarddiskPlugin()]

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

plugins:[newHtmlWebpackPlugin({alwaysWriteToDisk:true}),newHtmlWebpackPlugin({alwaysWriteToDisk:true,filename:'demo.html'}),newHtmlWebpackPlugin({alwaysWriteToDisk:false,filename:'test.html'}),newHtmlWebpackHarddiskPlugin()]

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

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors12


[8]ページ先頭

©2009-2025 Movatter.jp