From f16dc48025cc7db554c3d000682cb3dcb031492d Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Wed, 9 Sep 2015 11:46:22 +0200 Subject: [PATCH] Fix minify and head injection --- index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 00dac75..2563513 100644 --- a/index.js +++ b/index.js @@ -194,7 +194,7 @@ HtmlWebpackPlugin.prototype.evaluateCompilationResult = function(compilation, co } catch (e) { // Log syntax error var syntaxError = require('syntax-error')(source); - var errorMessage = 'Template compilation failed: ' + e + + var errorMessage = 'Template compilation failed: ' + e + (syntaxError ? '\n' + syntaxError + '\n\n\n' + source.split('\n').map(function(row, i) { return (1 + i) + ' - ' + row; }).join('\n') : ''); @@ -255,10 +255,8 @@ HtmlWebpackPlugin.prototype.postProcessHtml = function(html, assets) { .then(function(html) { if (self.options.minify) { var minify = require('html-minifier').minify; - // If `options.minify` is set to true use the default minify options - var minifyOptions = _.isObject(self.options.minify) ? self.options.minify : {}; try { - return minify(html, minifyOptions); + return minify(html, this.options.minify); } catch(e) { Promise.reject(e); } @@ -430,7 +428,7 @@ HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function(html, assets) { head = head.concat(styles); // Add scripts to body or head if (this.options.inject === 'head') { - head = body.concat(scripts); + head = head.concat(scripts); } else { body = body.concat(scripts); }