- Notifications
You must be signed in to change notification settings - Fork37
Write html files to hard disk even when using the webpack dev server or middleware
License
jantimon/html-webpack-harddisk-plugin
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
You must be running webpack on node 10.x or higher
Install the plugin with npm:
$ npm install --save-dev html-webpack-harddisk-plugin
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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors12
Uh oh!
There was an error while loading.Please reload this page.