From bf5901e5c0da5a0f36f88aa1f9b73c3e3315e4fa Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Tue, 15 Mar 2016 12:31:28 +0100 Subject: [PATCH] Add xhtml option to make link tags self-closing --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7838ba1..ea0c0ce 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,8 @@ function HtmlWebpackPlugin (options) { showErrors: true, chunks: 'all', excludeChunks: [], - title: 'Webpack App' + title: 'Webpack App', + xhtml: false }, options); } @@ -415,9 +416,11 @@ HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function (html, assets) { var scripts = assets.js.map(function (scriptPath) { return ''; }); + // Make tags self-closing in case of xhtml + var xhtml = this.options.xhtml ? '/' : ''; // Turn css files into link tags var styles = assets.css.map(function (stylePath) { - return ''; + return ''; }); // Injections var htmlRegExp = /(]*>)/i; @@ -428,7 +431,7 @@ HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function (html, assets) { // If there is a favicon present, add it to the head if (assets.favicon) { - head.push(''); + head.push(''); } // Add styles to the head head = head.concat(styles);