Skip to content

Commit c229fcb

Browse files
committed
Add html-webpack-plugin-alter-chunks event
1 parent 998ebf0 commit c229fcb

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Change History
22
==============
33

4+
v2.19.0
5+
----
6+
* Add `html-webpack-plugin-alter-chunks` event for custom chunk sorting and interpolation
7+
48
v2.18.0
59
----
610
* Updated all dependencies

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,17 @@ Events
244244

245245
To allow other [plugins](https://github.com/webpack/docs/wiki/plugins) to alter the html this plugin executes the following events:
246246

247+
Asnyc:
248+
247249
* `html-webpack-plugin-before-html-generation`
248250
* `html-webpack-plugin-before-html-processing`
249251
* `html-webpack-plugin-after-html-processing`
250252
* `html-webpack-plugin-after-emit`
251253

254+
Sync:
255+
256+
* `html-webpack-plugin-alter-chunks`
257+
252258
Example implementation: [html-webpack-harddisk-plugin](https://github.com/jantimon/html-webpack-harddisk-plugin)
253259

254260
Usage:

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ HtmlWebpackPlugin.prototype.apply = function (compiler) {
6868
var chunks = self.filterChunks(compilation.getStats().toJson(), self.options.chunks, self.options.excludeChunks);
6969
// Sort chunks
7070
chunks = self.sortChunks(chunks, self.options.chunksSortMode);
71+
// Let plugins alter the chunks and the chunk sorting
72+
chunks = compilation.applyPluginsWaterfall('html-webpack-plugin-alter-chunks', chunks, { plugin: self });
7173
// Get assets
7274
var assets = self.htmlWebpackPluginAssets(compilation, chunks);
7375
// If this is a hot update compilation, move on!

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-webpack-plugin",
3-
"version": "2.18.0",
3+
"version": "2.19.0",
44
"description": "Simplifies creation of HTML files to serve your webpack bundles",
55
"main": "index.js",
66
"files": [

0 commit comments

Comments
 (0)