Compare commits
2 Commits
88eab4ece2
...
d749325836
| Author | SHA1 | Date | |
|---|---|---|---|
| d749325836 | |||
| 8ecdd39be7 |
|
|
@ -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,
|
`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.
|
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`
|
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.
|
and they'll automatically work in your app.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ export type HypeProps = {
|
||||||
pico?: boolean
|
pico?: boolean
|
||||||
reset?: boolean
|
reset?: boolean
|
||||||
prettyHTML?: boolean
|
prettyHTML?: boolean
|
||||||
|
layout?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Hype<
|
export class Hype<
|
||||||
|
|
@ -151,7 +152,7 @@ export class Hype<
|
||||||
|
|
||||||
const page = await import(path + `?t=${Date.now()}`)
|
const page = await import(path + `?t=${Date.now()}`)
|
||||||
const innerHTML = typeof page.default === 'function' ? <page.default c={c} req={c.req} /> : page.default
|
const innerHTML = typeof page.default === 'function' ? <page.default c={c} req={c.req} /> : page.default
|
||||||
const withLayout = Layout ? <Layout props={this.props}>{innerHTML}</Layout> : innerHTML
|
const withLayout = this.props.layout !== false ? <Layout props={this.props}>{innerHTML}</Layout> : innerHTML
|
||||||
return c.html(withLayout)
|
return c.html(withLayout)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -160,6 +161,7 @@ export class Hype<
|
||||||
this.registerRoutes()
|
this.registerRoutes()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
port: process.env.PORT ?? '3000',
|
||||||
fetch: this.fetch,
|
fetch: this.fetch,
|
||||||
idleTimeout: 255
|
idleTimeout: 255
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user