diff --git a/third_party/eleventy-plugin-local-images/.eleventy.js b/third_party/eleventy-plugin-local-images/.eleventy.js index c9ab055..ec36e44 100644 --- a/third_party/eleventy-plugin-local-images/.eleventy.js +++ b/third_party/eleventy-plugin-local-images/.eleventy.js @@ -123,6 +123,20 @@ const grabRemoteImages = async (rawContent, outputPath) => { let content = rawContent; if (outputPath && outputPath.endsWith(".html")) { + // Optimization: fast exit if content doesn't contain images or metadata + // Only apply this optimization if the selector is one of the known defaults + // to avoid breaking custom selectors. + const projectSelector = + "img,amp-img,amp-video,meta[property='og:image'],meta[name='twitter:image'],amp-story"; + + if (selector === "img" || selector === projectSelector) { + const triggers = + /