mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
28 lines
542 B
TypeScript
28 lines
542 B
TypeScript
import { readFileSync } from 'fs';
|
|
import satori from 'satori';
|
|
|
|
const fonts = [
|
|
{
|
|
data: readFileSync(require('./Roboto.ttf')),
|
|
weight: 400 as const,
|
|
name: 'Roboto',
|
|
},
|
|
{
|
|
data: readFileSync(require('./Roboto-Bold.ttf')),
|
|
weight: 700 as const,
|
|
name: 'Roboto-Bold',
|
|
},
|
|
{
|
|
data: readFileSync(require('./Roboto-Black.ttf')),
|
|
weight: 900 as const,
|
|
name: 'Roboto-Black',
|
|
},
|
|
];
|
|
|
|
export default async function jsxToSvg(jsx: JSX.Element) {
|
|
return await satori(jsx, {
|
|
width: 480,
|
|
fonts,
|
|
});
|
|
}
|