1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// template to return svg in request
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
export default async function(req: Request): Promise<Response> {
const svg = render(
<svg
xmlns="http://www.w3.org/2000/svg"
width="256"
height="256"
viewBox="0 0 256 256"
fill="#fff"
>
{/* empty svg */}
</svg>,
);
return new Response(svg, { headers: { "Content-Type": "image/svg+xml;charset=utf-8" } });
}