Skip to content

dev: render pages on request with --lazy #55

Description

@lukeed

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.

  1. 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.
  2. Flush the assets as today.
  3. 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 only path of build(), which already renders one page with the full context.
  4. In http.ts, deliver() resolves a pending entry on its first request, caches the bytes, and serves them.
  5. 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 build does not change.

Done when

  • bongo dev --lazy serves 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.

Activity

  1. added
    enhancement
    on Oct 14, 2026
  2. added theissue type on Oct 20, 2026
  3. removed
    enhancement
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions