Add documentation for `html-webpack-plugin-alter-asset-tags`

This commit is contained in:
Jan Nicklas 2016-06-10 14:11:01 +02:00
parent c43bb4359f
commit 86badc3d6e
7 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,10 @@
Change History
==============
v2.21.0
----
* Add `html-webpack-plugin-alter-asset-tags` event to allow plugins to adjust the script/link tags
v2.20.0
----
* Exclude chunks works now even if combined with dependency sort

View File

@ -248,6 +248,7 @@ Asnyc:
* `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`

View File

@ -145,7 +145,7 @@ HtmlWebpackPlugin.prototype.apply = function (compiler) {
.then(function (html) {
// Prepare script and link tags
var assetTags = self.generateAssetTags(assets);
var pluginArgs = {head: assetTags.head, body: assetTags.body, plugin: self, outputName: self.childCompilationOutputName};
var pluginArgs = {head: assetTags.head, body: assetTags.body, plugin: self, chunks: chunks, outputName: self.childCompilationOutputName};
// Allow plugins to change the assetTag definitions
return applyPluginsAsyncWaterfall('html-webpack-plugin-alter-asset-tags', pluginArgs)
.then(function () {
@ -456,7 +456,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu
/**
* Injects the assets into the given html string
*/
HtmlWebpackPlugin.prototype.generateAssetTags = function (assets, applyPluginsAsyncWaterfall) {
HtmlWebpackPlugin.prototype.generateAssetTags = function (assets) {
// Turn script files into script tags
var scripts = assets.js.map(function (scriptPath) {
return {

View File

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

View File

@ -20,7 +20,7 @@ var HtmlWebpackPlugin = require('../index.js');
var OUTPUT_DIR = path.join(__dirname, '../dist');
jasmine.getEnv().defaultTimeoutInterval = 10000;
jasmine.getEnv().defaultTimeoutInterval = 30000;
function testHtmlPlugin (webpackConfig, expectedResults, outputFile, done, expectErrors, expectWarnings) {
outputFile = outputFile || 'index.html';

View File

@ -18,7 +18,7 @@ var HtmlWebpackPlugin = require('../index.js');
var OUTPUT_DIR = path.join(__dirname, '../dist');
jasmine.getEnv().defaultTimeoutInterval = 10000;
jasmine.getEnv().defaultTimeoutInterval = 30000;
function setUpCompiler (htmlWebpackPlugin) {
spyOn(htmlWebpackPlugin, 'evaluateCompilationResult').and.callThrough();

View File

@ -20,7 +20,7 @@ var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
var OUTPUT_DIR = path.join(__dirname, '../dist');
jasmine.getEnv().defaultTimeoutInterval = 10000;
jasmine.getEnv().defaultTimeoutInterval = 30000;
function runExample (exampleName, done) {
var examplePath = path.resolve(__dirname, '..', 'examples', exampleName);