Guard against falsy outputPath in eleventy htmlmin transform

Eleventy passes a falsy outputPath to transforms for templates rendered
without a written file (e.g. permalink: false); calling .endsWith on it
would throw. Skip minification in that case instead. Pre-existing latent
issue surfaced by Copilot review on #2091.
This commit is contained in:
Dmitry Verkhoturov
2026-06-30 20:59:57 +01:00
parent 7fee12a978
commit d7fe27cb97
+2 -1
View File
@@ -87,7 +87,8 @@ module.exports = function (eleventyConfig) {
// Minify HTML output
eleventyConfig.addTransform('htmlmin', async function (content, outputPath) {
if (!outputPath.endsWith('.html')) {
// outputPath is falsy for templates rendered without a written file (e.g. permalink: false)
if (!outputPath || !outputPath.endsWith('.html')) {
return content
}