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:
export default ({ children, title }: any) =>
```tsx
export default ({ children, title }: any) => (
<html lang="en">
<head>
<title>{title ?? 'hype'}</title>
<title>{title ?? "hype"}</title>
<meta charset="utf-8" />
<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>
</head>
<body>
<main>
{children}
</main>
<main>{children}</main>
</body>
</html>
)
```
(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`:
<link href="/css/reset.css" rel="stylesheet" />
```html
<link href="/css/reset.css" rel="stylesheet" />
```
### js
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 { initAbout } from './about'
import utils from './shared/utils'
```typescript
import { initAbout } from "./about"
import utils from "./shared/utils"
```
### pub
@ -152,5 +159,8 @@ export default app.defaults
4. Enter dev mode
bun install
bun test
```sh
bun install
bun test
``
```