spb/countryatlas
Public
TypeScript 57%
Python 38.6%
JavaScript 3.6%
CSS 0.6%
1// Rasterise src/app/icon.svg → icon.png (512) + apple-icon.png (180). Run after editing the SVG.2import { chromium } from 'playwright';3import { readFileSync } from 'node:fs';4const svg = readFileSync(new URL('../src/app/icon.svg', import.meta.url), 'utf8');5const browser = await chromium.launch();6for (const [size, file] of [[512, '../src/app/icon.png'], [180, '../src/app/apple-icon.png']]) {7 const ctx = await browser.newContext({ viewport: { width: size, height: size }, deviceScaleFactor: 1 });8 const page = await ctx.newPage();9 await page.setContent(`<html><body style="margin:0;background:transparent">${svg.replace(/width="\d+" height="\d+"/, `width="${size}" height="${size}"`)}</body></html>`);10 await page.screenshot({ path: new URL(file, import.meta.url).pathname, omitBackground: true, clip: { x: 0, y: 0, width: size, height: size } });11 await ctx.close();12}13await browser.close();14console.log('favicons written');15