diff --git a/default_index.html b/default_index.html
index e79eae8..8cbdc80 100644
--- a/default_index.html
+++ b/default_index.html
@@ -1,15 +1,15 @@
-
+
{%=o.htmlWebpackPlugin.options.title || 'Webpack App'%}
- {% for (var css in o.htmlWebpackPlugin.assets.css) { %}
-
+ {% for (var css in o.htmlWebpackPlugin.files.css) { %}
+
{% } %}
- {% for (var chunk in o.htmlWebpackPlugin.assets.chunks) { %}
-
+ {% for (var chunk in o.htmlWebpackPlugin.files.chunks) { %}
+
{% } %}
diff --git a/index.js b/index.js
index 2d3cd30..e5b8360 100644
--- a/index.js
+++ b/index.js
@@ -15,7 +15,8 @@ HtmlWebpackPlugin.prototype.apply = function(compiler) {
templateParams.webpack = webpackStatsJson;
templateParams.hash = webpackStatsJson.hash;
templateParams.htmlWebpackPlugin = {};
- templateParams.htmlWebpackPlugin.assets = self.htmlWebpackPluginAssets(compilation, webpackStatsJson);
+ templateParams.htmlWebpackPlugin.assets = self.htmlWebpackPluginLegacyAssets(compilation, webpackStatsJson);
+ templateParams.htmlWebpackPlugin.files = self.htmlWebpackPluginAssets(compilation, webpackStatsJson);
templateParams.htmlWebpackPlugin.options = self.options;
var outputFilename = self.options.filename || 'index.html';
@@ -66,7 +67,7 @@ HtmlWebpackPlugin.prototype.emitHtml = function(compilation, htmlTemplateContent
HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function(compilation, webpackStatsJson) {
var assets = {
// Will contain all js & css files by chunk
- chunks: [],
+ chunks: {},
// Will contain all js files
js: [],
// Will contain all css files
@@ -103,4 +104,18 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function(compilation, webp
return assets;
};
+/**
+ * A helper to support the templates written for html-webpack-plugin <= 1.1.0
+ */
+HtmlWebpackPlugin.prototype.htmlWebpackPluginLegacyAssets = function(compilation, webpackStatsJson) {
+ var assets = this.htmlWebpackPluginAssets(compilation, webpackStatsJson);
+ var legacyAssets = {};
+ Object.keys(assets.chunks).forEach(function(chunkName){
+ legacyAssets[chunkName] = assets.chunks[chunkName].entry;
+ });
+ return legacyAssets;
+};
+
+
+
module.exports = HtmlWebpackPlugin;
diff --git a/spec/HtmlWebpackPluginSpec.js b/spec/HtmlWebpackPluginSpec.js
index 96a2cd0..717e105 100644
--- a/spec/HtmlWebpackPluginSpec.js
+++ b/spec/HtmlWebpackPluginSpec.js
@@ -83,6 +83,34 @@ describe('HtmlWebpackPlugin', function() {
['
+ Test
+
+
+ Some unique text
+
+
+