Add html-webpack-plugin-alter-chunks event

This commit is contained in:
Jan Nicklas 2016-05-30 11:59:17 +02:00
parent 998ebf03eb
commit c229fcbab2
4 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,10 @@
Change History
==============
v2.19.0
----
* Add `html-webpack-plugin-alter-chunks` event for custom chunk sorting and interpolation
v2.18.0
----
* Updated all dependencies

View File

@ -244,11 +244,17 @@ Events
To allow other [plugins](https://github.com/webpack/docs/wiki/plugins) to alter the html this plugin executes the following events:
Asnyc:
* `html-webpack-plugin-before-html-generation`
* `html-webpack-plugin-before-html-processing`
* `html-webpack-plugin-after-html-processing`
* `html-webpack-plugin-after-emit`
Sync:
* `html-webpack-plugin-alter-chunks`
Example implementation: [html-webpack-harddisk-plugin](https://github.com/jantimon/html-webpack-harddisk-plugin)
Usage:

View File

@ -68,6 +68,8 @@ HtmlWebpackPlugin.prototype.apply = function (compiler) {
var chunks = self.filterChunks(compilation.getStats().toJson(), self.options.chunks, self.options.excludeChunks);
// Sort chunks
chunks = self.sortChunks(chunks, self.options.chunksSortMode);
// Let plugins alter the chunks and the chunk sorting
chunks = compilation.applyPluginsWaterfall('html-webpack-plugin-alter-chunks', chunks, { plugin: self });
// Get assets
var assets = self.htmlWebpackPluginAssets(compilation, chunks);
// If this is a hot update compilation, move on!

View File

@ -1,6 +1,6 @@
{
"name": "html-webpack-plugin",
"version": "2.18.0",
"version": "2.19.0",
"description": "Simplifies creation of HTML files to serve your webpack bundles",
"main": "index.js",
"files": [