From 19b136687f07df93c1fff9053eff8d005a137ece Mon Sep 17 00:00:00 2001 From: Takuya Fukuju Date: Sat, 25 Mar 2023 19:57:16 +0900 Subject: [PATCH] =?UTF-8?q?refactor(eleventy):=20`setImageDimensions`=20?= =?UTF-8?q?=E3=83=88=E3=83=A9=E3=83=B3=E3=82=B9=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=83=A0=E3=81=AE=E5=86=85=E9=83=A8=E9=96=A2=E6=95=B0=E5=90=8D?= =?UTF-8?q?=E3=82=92=E6=94=B9=E5=96=84=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 11ty/transforms/set-image-dimensions.cjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/11ty/transforms/set-image-dimensions.cjs b/11ty/transforms/set-image-dimensions.cjs index 643080f7..41986f4d 100644 --- a/11ty/transforms/set-image-dimensions.cjs +++ b/11ty/transforms/set-image-dimensions.cjs @@ -27,7 +27,7 @@ const isUrl = (string) => { } }; -const normalizeSourceUrl = (sourceUrl, outputPath) => { +const rebaseSourceUrl = (sourceUrl, outputPath) => { if (isUrl(sourceUrl)) { return sourceUrl; } @@ -87,7 +87,7 @@ const setImageDimensions = async function (content) { .filter((item) => isValidSourceUrl(item.src)) .map(async (item) => { const metadata = await getMetadata( - normalizeSourceUrl(item.src, this.page.outputPath), + rebaseSourceUrl(item.src, this.page.outputPath), ); setDimensions(item, metadata.width, metadata.height); @@ -96,7 +96,7 @@ const setImageDimensions = async function (content) { .filter((item) => isValidSourceUrl(parseSrcset(item.srcset)[0].url)) .map(async (item) => { const metadata = await getMetadata( - normalizeSourceUrl( + rebaseSourceUrl( parseSrcset(item.srcset)[0].url, this.page.outputPath, ),