diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0b11b..e77a578 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index d3d447b..9b33aeb 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/index.js b/index.js index ffd73cd..40766e7 100644 --- a/index.js +++ b/index.js @@ -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! diff --git a/package.json b/package.json index 977cacb..f5ab2e3 100644 --- a/package.json +++ b/package.json @@ -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": [