🐛 Fix links to broken images

This commit is contained in:
Gal 2024-03-02 08:50:28 +01:00
parent 5ffd94d9ca
commit 6bdb536366
Signed by: gal
GPG Key ID: F035BC65003BC00B
1 changed files with 5 additions and 1 deletions

View File

@ -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