Skip to content

Commit

Permalink
Update README with Tapable.hooks example (#941)
Browse files Browse the repository at this point in the history
Webpack v4 deprecates the use of `Tapable.plugin()`. This plugin was updated to use `Tapable.hooks`, but the example in the README was not.
  • Loading branch information
t-kelly authored and mastilver committed May 3, 2018
1 parent a3ef514 commit b4312f9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -289,17 +289,17 @@ plugins: [

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

#### `Sync`
#### `SyncWaterfallHook`

* `html-webpack-plugin-alter-chunks`
* `htmlWebpackPluginAlterChunks`

#### `Async`
#### `AsyncSeriesWaterfallHook`

* `html-webpack-plugin-before-html-generation`
* `html-webpack-plugin-before-html-processing`
* `html-webpack-plugin-alter-asset-tags`
* `html-webpack-plugin-after-html-processing`
* `html-webpack-plugin-after-emit`
* `htmlWebpackPluginBeforeHtmlGeneration`
* `htmlWebpackPluginBeforeHtmlProcessing`
* `htmlWebpackPluginAlterAssetTags`
* `htmlWebpackPluginAfterHtmlProcessing`
* `htmlWebpackPluginAfterEmit`

Example implementation: [html-webpack-harddisk-plugin](https://github.com/jantimon/html-webpack-harddisk-plugin)

Expand All @@ -310,11 +310,11 @@ function MyPlugin(options) {
}

MyPlugin.prototype.apply = function (compiler) {
compiler.plugin('compilation', (compilation) => {
compiler.hooks.compilation.tap('MyPlugin', (compilation) => {
console.log('The compiler is starting a new compilation...');

compilation.plugin(
'html-webpack-plugin-before-html-processing',
compilation.hooks.htmlWebpackPluginAfterHtmlProcessing.tapAsync(
'MyPlugin',
(data, cb) => {
data.html += 'The Magic Footer'

Expand Down

0 comments on commit b4312f9

Please sign in to comment.