OpenTalon / website · opentalon.ai / tools / social-card.mjs
| 1 | // Renders tools/social-card.html to public/social-card-v4.png at 1200x630. |
| 2 | // Run from site/: node tools/social-card.mjs |
| 3 | import { createRequire } from 'node:module' |
| 4 | import { fileURLToPath } from 'node:url' |
| 5 | |
| 6 | const { chromium } = createRequire(import.meta.url)('playwright') |
| 7 | const browser = await chromium.launch() |
| 8 | const page = await browser.newPage({ viewport: { width: 1200, height: 630 }, deviceScaleFactor: 1 }) |
| 9 | await page.goto(new URL('./social-card.html', import.meta.url).href) |
| 10 | await page.evaluate(() => document.fonts.ready) |
| 11 | await page.screenshot({ path: fileURLToPath(new URL('../public/social-card-v4.png', import.meta.url)) }) |
| 12 | await browser.close() |