From d7493258368210abfa31a837e6a70bd162b50070 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 21 Dec 2025 15:49:21 -0800 Subject: [PATCH] layout: false --- README.md | 2 ++ src/index.tsx | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1336030..db3f0fa 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ To put a file in `./src/pages` but prevent it from being server, preface it with `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. +You can also create hype with `new Hype({ layout: false })` to disable Hype's default. + Using the default layout, you can put TS in `./src/js/main.ts` and css in `./src/css/main.css` and they'll automatically work in your app. diff --git a/src/index.tsx b/src/index.tsx index d2fd142..7125164 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -19,6 +19,7 @@ export type HypeProps = { pico?: boolean reset?: boolean prettyHTML?: boolean + layout?: boolean } export class Hype< @@ -151,7 +152,7 @@ export class Hype< const page = await import(path + `?t=${Date.now()}`) const innerHTML = typeof page.default === 'function' ? : page.default - const withLayout = Layout ? {innerHTML} : innerHTML + const withLayout = this.props.layout !== false ? {innerHTML} : innerHTML return c.html(withLayout) }) }