Skip to content

Commit

Permalink
refactor(eleventy): setImageDimensions トランスフォームの内部関数名を改善する
Browse files Browse the repository at this point in the history
  • Loading branch information
chalkygames123 committed Mar 25, 2023
1 parent fb0b679 commit 19b1366
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 11ty/transforms/set-image-dimensions.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const isUrl = (string) => {
}
};

const normalizeSourceUrl = (sourceUrl, outputPath) => {
const rebaseSourceUrl = (sourceUrl, outputPath) => {
if (isUrl(sourceUrl)) {
return sourceUrl;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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,
),
Expand Down

0 comments on commit 19b1366

Please sign in to comment.