From ca2c446b2c0621b6babd376413bac8b3c79f4744 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 12 Feb 2023 18:32:10 +0100 Subject: [PATCH] Fix image path of webmanifests --- scripts/generateLayouts.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts index 3d4bf282e..a456078d3 100644 --- a/scripts/generateLayouts.ts +++ b/scripts/generateLayouts.ts @@ -23,8 +23,8 @@ async function createIcon(iconPath: string, size: number, alreadyWritten: string name = name.substr(2) } - const newname = `public/assets/generated/images/${name.replace(/\//g, "_")}${size}.png` - + const newname = `assets/generated/images/${name.replace(/\//g, "_")}${size}.png` + const targetpath = `public/${newname}` if (alreadyWritten.indexOf(newname) >= 0) { return newname } @@ -41,7 +41,7 @@ async function createIcon(iconPath: string, size: number, alreadyWritten: string // We already read to file, in order to crash here if the file is not found let img = await sharp(iconPath) let resized = await img.resize(size) - await resized.toFile(newname) + await resized.toFile(targetpath) console.log("Created png version at ", newname) } catch (e) { console.error("Could not read icon", iconPath, " to create a PNG due to", e) @@ -273,7 +273,7 @@ async function createLandingPage(layout: LayoutConfig, manifest, whiteIcons, alr '', `` ) - 0 + try { output = output .replace(