A SvelteKit route that server-renders a Svelte component to HTML, then returns it as a 1200 × 630 image with ImageResponse from takumi-js.
Build the image example packages first. Then start SvelteKit with portless:
cd example/svelte
bunx portless run --name takumi-svelte bunx vite devOpen https://takumi-svelte.localhost/?name=Kane to see the image.
- The route is
src/routes/+server.ts. It passes the component's HTML and the compiled Tailwind CSS fromapp.csstoImageResponse. - The route loads Geist from
takumi.kane.tw, so rendering needs network access. vite.config.tsmarks@takumi-rs/coreas an SSR external, so Vite loads the native addon fromnode_modules.