Fix image path of webmanifests

This commit is contained in:
Pieter Vander Vennet 2023-02-12 18:32:10 +01:00
parent f2de8bfad2
commit ca2c446b2c

View file

@ -23,8 +23,8 @@ async function createIcon(iconPath: string, size: number, alreadyWritten: string
name = name.substr(2) 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) { if (alreadyWritten.indexOf(newname) >= 0) {
return newname 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 // We already read to file, in order to crash here if the file is not found
let img = await sharp(iconPath) let img = await sharp(iconPath)
let resized = await img.resize(size) let resized = await img.resize(size)
await resized.toFile(newname) await resized.toFile(targetpath)
console.log("Created png version at ", newname) console.log("Created png version at ", newname)
} catch (e) { } catch (e) {
console.error("Could not read icon", iconPath, " to create a PNG due to", 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
'<script type="module" src="./index.ts"></script>', '<script type="module" src="./index.ts"></script>',
`<script type="module" src='./index_${layout.id}.ts'></script>` `<script type="module" src='./index_${layout.id}.ts'></script>`
) )
0
try { try {
output = output output = output
.replace( .replace(