Skip to content

Docs: serving static builds with serve.json - #68

Merged
tmashara merged 2 commits into
mainfrom
claude/issue-52-serve-json
Oct 29, 2026
Merged

tmashara merged 2 commits into
mainfrom
claude/issue-52-serve-json

Conversation

@tmashara

@tmashara tmashara commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

What

Expands the "Static builds" bullet in skills/renderdiff/reference.md (the only place that documents serving): what serve already does, how to match the host's trailing-slash behaviour with a serve.json passed via -c, and how to serve a docs build under the marketing one on a single origin.

Why

A static server whose trailing-slash or subpath behaviour differs from the real host makes routes 404 or redirect on one side only, which shows up as false diffs.

The #59 report said npx serve doesn't resolve slashless URLs to .html. That didn't reproduce on serve 14.2.6 (serve-handler 6.1.7): clean URLs are on by default (/about -> about.html, /docs -> docs/index.html, /about.html -> 301 /about). The real gaps are:

  • Trailing slashes are left alone by default (both forms 200). { "trailingSlash": true } redirects /docs -> /docs/; false the reverse.
  • Docs fallback: rewrites only remap paths inside the one served dir, get no clean-URL resolution and have no fallthrough, so they can't mount a second build. A directory symlink (ln -s "$PWD/docs/dist" dist/docs) works with no config (no "symlinks": true needed); it lives inside dist, so a rebuild that wipes dist drops it and it has to be redone.

Also documented: -c resolves relative to the served dir (so -c ../serve.json keeps the config outside dist, safe from rebuilds and not served as /serve.json), and the config is read at startup.

README and docs/ don't cover serving today, so they're left alone.

Verified

  • Each claim above probed with npx serve@14.2.6 against throwaway fixture dirs and curl -I (clean URLs, trailingSlash true/false, -c path resolution, rewrites limitation, symlinked dir with nested pages, restart needed after edit).
  • npm run format:check, npm run lint, npm test pass (docs-only change).

Fixes #52

🤖 Generated with Claude Code

tmashara and others added 2 commits October 29, 2026 17:41
…builds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rding

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmashara
tmashara merged commit 83ee51c into main Oct 29, 2026
3 checks passed
@tmashara
tmashara deleted the claude/issue-52-serve-json branch October 29, 2026 16:51
@tmashara tmashara mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: serve static builds with serve.json (clean URLs, trailing slash, rewrites)

1 participant