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

View File

@ -55,10 +55,11 @@ 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
export default ({ children, title }: any) => (
<html lang="en"> <html lang="en">
<head> <head>
<title>{title ?? 'hype'}</title> <title>{title ?? "hype"}</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@ -66,11 +67,11 @@ If `_layout.tsx` exists, your pages will automatically be wrapped in it:
<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}
</main>
</body> </body>
</html> </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`:
```html
<link href="/css/reset.css" rel="stylesheet" /> <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`:
```html
<script src="/js/main.ts" type="module"></script> <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,8 @@ export default app.defaults
4. Enter dev mode 4. Enter dev mode
```sh
bun install bun install
bun test bun test
``
```