This commit is contained in:
Chris Wanstrath 2025-11-29 11:22:06 -08:00
parent 1f8c6bde50
commit 4875c08757

View File

@ -55,22 +55,23 @@ The `req` JSX prop will be given the `Hono` request:
If `_layout.tsx` exists, your pages will automatically be wrapped in it: If `_layout.tsx` exists, your pages will automatically be wrapped in it:
export default ({ children, title }: any) => ```tsx
<html lang="en"> export default ({ children, title }: any) => (
<head> <html lang="en">
<title>{title ?? 'hype'}</title> <head>
<meta charset="utf-8" /> <title>{title ?? "hype"}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="/css/main.css" rel="stylesheet" /> <link href="/css/main.css" rel="stylesheet" />
<script src="/js/main.ts" type="module"></script> <script src="/js/main.ts" type="module"></script>
</head> </head>
<body> <body>
<main> <main>{children}</main>
{children} </body>
</main> </html>
</body> )
</html> ```
(Files starting with `_` don't get served directly.) (Files starting with `_` don't get served directly.)
@ -78,18 +79,24 @@ If `_layout.tsx` exists, your pages will automatically be wrapped in it:
CSS can be accessed via `/css/main.css`: CSS can be accessed via `/css/main.css`:
<link href="/css/reset.css" rel="stylesheet" /> ```html
<link href="/css/reset.css" rel="stylesheet" />
```
### js ### js
JS can be accessed (and transpiled) via `/js/main.ts` or `/shared/utils.ts`: JS can be accessed (and transpiled) via `/js/main.ts` or `/shared/utils.ts`:
<script src="/js/main.ts" type="module"></script> ```html
<script src="/js/main.ts" type="module"></script>
```
import your modules relatively, for example in `main.ts`: import your modules relatively, for example in `main.ts`:
import { initAbout } from './about' ```typescript
import utils from './shared/utils' import { initAbout } from "./about"
import utils from "./shared/utils"
```
### pub ### pub
@ -152,5 +159,7 @@ export default app.defaults
4. Enter dev mode 4. Enter dev mode
bun install ```sh
bun test bun install
bun test
```