shareon
shareon copied to clipboard
Generate screenshot automatically
Currently, the screenshot in the README is created manually by me. The process can be easily automated, though. So far, my steps are:
- Start dev server
- Select element with the buttons (
.specimen) - Make a screenshot of node
- Resize
- Save
But I think this all can be replaced with Playwright and Sharp.
import { firefox } from 'playwright';
const browser = await firefox.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://localhost:5173/');
const buffer = await page.locator('.shareon.specimen').screenshot();
// TODO: learn Sharp
Then, put it into CI and run on icon/button changes. Can be a nice weekend project.