// Rasterise src/app/icon.svg → icon.png (512) + apple-icon.png (180). Run after editing the SVG. import { chromium } from 'playwright'; import { readFileSync } from 'node:fs'; const svg = readFileSync(new URL('../src/app/icon.svg', import.meta.url), 'utf8'); const browser = await chromium.launch(); for (const [size, file] of [[512, '../src/app/icon.png'], [180, '../src/app/apple-icon.png']]) { const ctx = await browser.newContext({ viewport: { width: size, height: size }, deviceScaleFactor: 1 }); const page = await ctx.newPage(); await page.setContent(`${svg.replace(/width="\d+" height="\d+"/, `width="${size}" height="${size}"`)}`); await page.screenshot({ path: new URL(file, import.meta.url).pathname, omitBackground: true, clip: { x: 0, y: 0, width: size, height: size } }); await ctx.close(); } await browser.close(); console.log('favicons written');