From 6bdb536366ba4de9a5e72087cd27dce0ad07bda9 Mon Sep 17 00:00:00 2001 From: Gal Date: Sat, 2 Mar 2024 08:50:28 +0100 Subject: [PATCH] :bug: Fix links to broken images --- quartz/build.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quartz/build.ts b/quartz/build.ts index 4146aae..bb8c66a 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -38,7 +38,11 @@ async function compressImages(inputDir, outputDir) { files.map(async (file) => { const inputFilePath = path.join(inputDir, file); const relativeOutputPath = path.relative(inputDir, inputFilePath); - const outputWebpPath = path.join(outputDir, relativeOutputPath.replace(/\.(jpg|png)$/, '.webp')); + const outputWebpPath = path.join( + outputDir, + relativeOutputPath.replace(/\.(jpg|png)$/, '.webp') + .replace(/\s+/g, '-') // Replace spaces with hyphens + ); try { // Check if the output WebP file already exists