@@ -0,0 +1,16 @@
|
||||
{
|
||||
"lock": false,
|
||||
"compilerOptions": {
|
||||
"jsx": "precompile",
|
||||
"jsxImportSource": "preact",
|
||||
"jsxPrecompileSkipElements": ["a", "img", "source", "body", "html", "head"]
|
||||
},
|
||||
"imports": {
|
||||
"@std/encoding": "jsr:@std/encoding@^0.224.0",
|
||||
"@std/fmt": "jsr:@std/fmt@^0.224.0",
|
||||
"@std/html": "jsr:@std/html@^0.224.0",
|
||||
"@std/path": "jsr:@std/path@^0.224.0",
|
||||
"preact": "npm:preact@^10.20.2",
|
||||
"preact-render-to-string": "npm:preact-render-to-string@^6.4.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { App } from "../../../src/app.ts";
|
||||
|
||||
const app = new App({ staticDir: "./static" }).get(
|
||||
"/",
|
||||
(ctx) =>
|
||||
ctx.render(
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>foo</title>
|
||||
</head>
|
||||
<body>
|
||||
<div f-client-nav>
|
||||
<span f-client-nav={false}>
|
||||
<p>false</p>
|
||||
</span>
|
||||
<a href="/">Home</a>
|
||||
<img src="/foo.jpg" alt="" />
|
||||
<picture>
|
||||
<source src="/bar.jpg" />
|
||||
</picture>
|
||||
</div>
|
||||
</body>
|
||||
</html>,
|
||||
),
|
||||
);
|
||||
|
||||
const handler = await app.handler();
|
||||
const res = await handler(new Request("http://localhost/"));
|
||||
console.log(await res.text());
|
||||
Reference in New Issue
Block a user