From 83d8a07fb3639c7ded6bca6a4a4163e359fa38f7 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 22 May 2020 11:56:37 +0200 Subject: [PATCH] Simplify html minify transform config --- src/transforms/html-min-transform.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/transforms/html-min-transform.js b/src/transforms/html-min-transform.js index 7d0c8f99..e84cbe30 100644 --- a/src/transforms/html-min-transform.js +++ b/src/transforms/html-min-transform.js @@ -1,14 +1,12 @@ const htmlmin = require('html-minifier'); module.exports = function htmlMinTransform(value, outputPath) { - if (outputPath.indexOf('.html') > -1) { - let minified = htmlmin.minify(value, { - useShortDoctype: true, - removeComments: true, - collapseWhitespace: true, - minifyCSS: true - }); - return minified; - } - return value; + if (!outputPath.endsWith('.html')) return value; + + return htmlmin.minify(value, { + useShortDoctype: true, + removeComments: true, + collapseWhitespace: true, + minifyCSS: true + }); };