From 58d173c3d0572e8366155d0a9c96b87ee8023006 Mon Sep 17 00:00:00 2001 From: Charles Blaxland Date: Thu, 14 Aug 2014 21:29:46 +1000 Subject: [PATCH] Raise an error if both template and templateContent options are used together --- index.js | 5 ++++- spec/HtmlWebpackPluginSpec.js | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 17a670d..4923a06 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,10 @@ HtmlWebpackPlugin.prototype.apply = function(compiler) { var outputFilename = self.options.filename || 'index.html'; - if (self.options.templateContent) { + if (self.options.templateContent && self.options.template) { + compiler.errors.push(new Error('HtmlWebpackPlugin: cannot specify both template and templateContent options')); + callback(); + } else if (self.options.templateContent) { self.emitHtml(compiler, self.options.templateContent, templateParams, outputFilename); callback(); } else { diff --git a/spec/HtmlWebpackPluginSpec.js b/spec/HtmlWebpackPluginSpec.js index 72619d8..e737806 100644 --- a/spec/HtmlWebpackPluginSpec.js +++ b/spec/HtmlWebpackPluginSpec.js @@ -83,6 +83,23 @@ describe('HtmlWebpackPlugin', function() { ['