🐛 Fix links to broken images
This commit is contained in:
parent
5ffd94d9ca
commit
6bdb536366
|
@ -38,7 +38,11 @@ async function compressImages(inputDir, outputDir) {
|
||||||
files.map(async (file) => {
|
files.map(async (file) => {
|
||||||
const inputFilePath = path.join(inputDir, file);
|
const inputFilePath = path.join(inputDir, file);
|
||||||
const relativeOutputPath = path.relative(inputDir, inputFilePath);
|
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 {
|
try {
|
||||||
// Check if the output WebP file already exists
|
// Check if the output WebP file already exists
|
||||||
|
|
Loading…
Reference in New Issue