diff --git a/index.js b/index.js index 18ac620..eaa47ac 100644 --- a/index.js +++ b/index.js @@ -31,12 +31,6 @@ function HtmlWebpackPlugin(options) { if(this.options.template.indexOf('!') === -1) { this.options.template = require.resolve('./loader.js') + '!' + path.resolve(this.options.template); } - // Resolve template path - this.options.template = this.options.template.replace( - /(\!)([^\/\\][^\!\?]+|[^\/\\!?])($|\?.+$)/, - function(match, prefix, filepath, postfix) { - return prefix + path.resolve(filepath) + postfix; - }); } HtmlWebpackPlugin.prototype.apply = function(compiler) { @@ -185,10 +179,6 @@ HtmlWebpackPlugin.prototype.evaluateCompilationResult = function(compilation, co if(!compilationResult) { return Promise.reject('The child compilation didn\'t provide a result'); } - if(typeof source === 'string') { - // If the compilation result is already evaluted return it - return Promise.resolve(source); - } // Strip the leading 'var ' var source = compilationResult.source().substr(3); // Evaluate code and cast to string diff --git a/package.json b/package.json index db402f4..8929732 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "jshint": "^2.8.0", "rimraf": "^2.4.1", "style-loader": "^0.12.3", + "underscore-template-loader": "^0.5.1", "url-loader": "^0.5.6", "webpack": "^1.10.1" }, diff --git a/spec/HtmlWebpackPluginSpec.js b/spec/HtmlWebpackPluginSpec.js index 76efc41..85e68ab 100644 --- a/spec/HtmlWebpackPluginSpec.js +++ b/spec/HtmlWebpackPluginSpec.js @@ -74,6 +74,40 @@ describe('HtmlWebpackPlugin', function() { }, ['