Auto-generated screenshots
The screenshots in these docs are not hand-captured — they are generated from Lua scripts so
they stay in sync with the app as it changes. Each screenshot is a small, deterministic scene
scripted with the same declarative and
bearcad.ui.* API you'd use anywhere else, ending in a
bearcad.ui.screenshot(...) capture.
How it works
- The scripts live in
docs-site/screenshots/*.lua. Each builds a representative scene, sets a fixed camera (bearcad.ui.view(...)) so the output is reproducible, and captures a PNG. - Each script writes to the directory named by the
BEARCAD_SCREENSHOT_OUTenvironment variable (falling back to the current directory), so the same script works both in the harness and when run by hand. scripts/gen-doc-screenshots.shbuilds the app, runs every script intodocs-site/static/img/screenshots/, and fails if any expected PNG is missing or empty. Docusaurus serves that folder as/img/screenshots/<name>.png.- The generated PNGs are build artifacts — they are git-ignored, regenerated on demand locally, and regenerated by CI before the site is built and deployed.
Regenerating locally
# Build the app and (re)generate every screenshot.
scripts/gen-doc-screenshots.sh
# Reuse an already-built binary (faster iteration):
BEARCAD_SKIP_BUILD=1 scripts/gen-doc-screenshots.sh
Capturing a screenshot needs a real rendered GPU frame. This works on a normal desktop (a
machine with a working display/GPU) and on CI Linux runners that provide a software Vulkan driver
under xvfb (mesa-vulkan-drivers + xvfb). In a fully headless environment with none of that,
the capture never resolves and the per-script timeout force-exits with no PNG — so run the
generator somewhere that can actually render.
Adding a new screenshot
- Add
docs-site/screenshots/<name>.lua. Build the scene, pick a fixed view, thenbearcad.ui.screenshot((os.getenv("BEARCAD_SCREENSHOT_OUT") or ".") .. "/<name>.png"). - Run
scripts/gen-doc-screenshots.shto produce<name>.png. - Reference it from a docs page with
.