# hype ░▒▓███████████████████████████████████████████████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓████████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓████████▓▒░░▒▓██████▓▒░░▒▓███████▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓████████▓▒░ ░▒▓███████████████████████████████████████████████▓▒░ `hype` wraps `hono` with useful defaults: - HTTP logging (disable with `NO_HTTP_LOG` env variable) - Static files served from `pub/` - Page-based routing to `.tsx` files that export a `JSX` function in `./src/pages` - Transpile `.ts` files in `src/js/blah.ts` via `website.com/js/blah.ts` ## Overview Your project structure should be: ``` . ├── README.md ├── package.json ├── pub │   ├── asset.txt │   └── img │   └── logo.png ├── src │   ├── css │   │   └── main.css │   ├── js │   │   ├── about.ts │   │   └── main.ts │   ├── shared │   │   └── utils.ts │   ├── pages │   │   ├── _layout.tsx │   │   ├── about.tsx │   │   └── index.tsx │   └── server.tsx └── tsconfig.json ``` ### URLs In the above, `/about` will render `./src/pages/about.tsx`. The `req` JSX prop will be given the `Hono` request: export default ({ req }) => `Query Param 'id': ${req.query('id')}` To put a file in `./src/pages` but prevent it from being server, preface it with `_`. ### Layout `hype` will wrap everything in a simple default layout unless `./src/pages/_layout.tsx` exists, in which case it'll use the default export in that file. Here's a starting point: ```tsx export default ({ children, title }: any) => ( {title ?? "hype"}
{children}
) ``` ### css CSS can be accessed via `/css/main.css`: ```html ``` Or written inline using the `css` template tag: ```tsx import { css } from "hype" export default () => (
{css` * { color: red; } `}

Hello

) ``` ### css reset `hype` includes a css reset for your convenience: ```html ``` ### js JS can be accessed (and transpiled) via `/js/main.ts` or `/shared/utils.ts`: ```html ``` import your modules relatively, for example in `main.ts`: ```typescript import { initAbout } from "./about" import utils from "./shared/utils" ``` Or written inline as transpiled typescript using the `js` template tag: ```tsx import { js } from "hype" export default () => (
{js` window.onload = () => alert(welcomeMsg(Date.now())) function welcomeMsg(time: number): string { return "Welcome to my website!" } `}

Hello!

) ``` ### pub Anything in `pub/` is served as-is. Simple stuff. ### utils `hype` includes helpful utils for your webapp: - `capitalize(str: string): string` - Capitalizes a word - `css` Template Tag - Lets you inline CSS in your TSX. Returns a `