From a40fd6cbcdba64c31a6456e17b2570b6ac9f3dfa Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Mon, 6 Jan 2025 09:05:44 -0600 Subject: [PATCH] Fix bug with `` #214 --- src/transform-plugin.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/transform-plugin.js b/src/transform-plugin.js index 6a5c83c..0d4e4da 100644 --- a/src/transform-plugin.js +++ b/src/transform-plugin.js @@ -168,7 +168,9 @@ function eleventyImageTransformPlugin(eleventyConfig, options = {}) { match.call(pictureNode, { tag: 'img' }, imgNode => { imgNode._insideOfPicture = true; - promises.push(transformTag(context, imgNode, pictureNode, opts)); + if(!isIgnored(imgNode) && !imgNode?.attrs?.src?.startsWith("data:")) { + promises.push(transformTag(context, imgNode, pictureNode, opts)); + } return imgNode; }); @@ -177,10 +179,10 @@ function eleventyImageTransformPlugin(eleventyConfig, options = {}) { }); tree.match({ tag: 'img' }, (imgNode) => { - if(imgNode._insideOfPicture || isIgnored(imgNode) || imgNode?.attrs?.src?.startsWith("data:")) { - cleanTag(imgNode); - + if(imgNode._insideOfPicture) { delete imgNode._insideOfPicture; + } else if(isIgnored(imgNode) || imgNode?.attrs?.src?.startsWith("data:")) { + cleanTag(imgNode); } else { promises.push(transformTag(context, imgNode, imgNode, opts)); }