From 40c2b78cf5915067556e59d3d24420404b3d2ccc Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 3 May 2024 14:00:43 -0400 Subject: [PATCH] Check for ELEVENTY_ENV for minifier (#237) * fix: check for ELEVENTY_ENV for minifier * turn on `conservativeCollapse` and `preserveLineBreaks` for HTML minifier --- .eleventy.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index c3a8724..ef41c1e 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -490,7 +490,7 @@ module.exports = function (eleventyConfig) { eleventyConfig.addTransform("htmlMinifier", (content, outputPath) => { if ( - process.env.NODE_ENV === "production" && + (process.env.NODE_ENV === "production" || process.env.ELEVENTY_ENV === "prod") && outputPath && outputPath.endsWith(".html") ) { @@ -498,6 +498,8 @@ module.exports = function (eleventyConfig) { useShortDoctype: true, removeComments: true, collapseWhitespace: true, + conservativeCollapse: true, + preserveLineBreaks: true, minifyCSS: true, minifyJS: true, keepClosingSlash: true,