1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 14:28:04 +00:00
_/vite-ssg/renderer/_default.page.server.ts

18 lines
464 B
TypeScript
Raw Normal View History

2022-01-22 14:16:50 +00:00
import { renderToString } from "solid-js/web";
import { escapeInject, dangerouslySkipEscape } from "vite-plugin-ssr";
import type { PageContextBuiltIn } from "vite-plugin-ssr/types";
export async function render(pageContext: PageContextBuiltIn) {
const page = renderToString(pageContext.Page);
return escapeInject`<!DOCTYPE html>
<html>
<head>
<title>vite-ssg-example</title>
</head>
<body>
${dangerouslySkipEscape(page)}
</body>
</html>
`;
}