Repository navigation
Open
Description
bongo dev renders every page before it serves the first one. On a large site, the first build and each full rebuild take time that a person who opens one page does not need.
Proposal
Add bongo dev --lazy. It renders a page only when the browser asks for it, and again after a change.
- Run walk 1 as today: scan
content/, run the loaders, and build$pages,$section, and$tags. Every page then exists with its full context, so links, lists, and feeds stay correct. - Flush the assets as today.
- For each page, store a pending entry in the dev memory sink, in place of rendered bytes. The entry is a function that renders that one page through the existing
onlypath ofbuild(), which already renders one page with the full context. - In
http.ts,deliver()resolves a pending entry on its first request, caches the bytes, and serves them. - On a change, mark the affected entries pending again instead of rendering them. A change to a layout, partial, config, or data file marks every page pending. A change to one content file marks that page pending, plus every page whose output depends on it (for example a list that reads its frontmatter).
Notes
- This builds on the in-memory dev output (the output sink in
packages/bongo/src/utils/output.ts). No other write path changes. - Output files, such as
sitemap.xml.hbs, and data modules read every page. They can stay eager, or render lazily on their own request. - The reload message must still reach open pages: a page that is pending after a change reloads, and renders on that request.
- Errors move from build time to request time. A page that fails to render should show the error overlay on its own request, and the terminal should still print the error.
bongo builddoes not change.
Done when
bongo dev --lazyserves the first page of a large site before it renders the rest.- A change re-renders only what a request needs.
- The dev tests cover a lazy first request, a change that marks a page pending, and a render error on request.
- The readme and the docs site document the flag.
Metadata
Metadata
Assignees
Labels
No labels
Activity