Offline builds

Deployment2 min read||

DocsLit can build your entire documentation site as a single HTML file. No server required — readers open the file in their browser by double-clicking it.

Build an offline site

npx docslit build --offline

This produces a dist/index.html file with everything inlined:

  • All page content embedded in window.__DOCSLIT_PAGES__
  • The search index embedded in window.__DOCSLIT_SEARCH_INDEX__
  • All components and styles included inline
  • Full navigation and search functionality

When to use offline builds

Offline vs static builds

Feature Static build Offline build
Output Multiple files in dist/ Single index.html
Server required Yes (any static host) No
SEO pages Yes (docs/*.html) No
Sitemap Yes No
Search Yes Yes
llms.txt Yes No
Static builds are better for production websites because they produce SEO-friendly pages and sitemaps. Offline builds are best for distributing docs as standalone files.

Size limits and large sites

Offline mode inlines every page, the search index, all components, and all styles into a single HTML file. That's exactly what makes it portable — and it's also what makes it scale poorly past a certain size.

Site size Typical offline file Boot time Recommendation
Up to ~50 pages < 1 MB Instant Offline is fine
50–200 pages 1–5 MB Sub-second on modern hardware Offline still works well
200+ pages, or > 5 MB 5 MB+ Noticeable JSON parse on open Use static build instead

docslit build --offline prints a warning when the output crosses ~5 MB or 200 pages, pointing to docslit build (the default) as the better fit for sites at that scale.

The default static build splits content into per-page HTML files with shared CSS and JavaScript. The browser only loads the page the reader is currently viewing, so first paint stays fast no matter how many pages your site has. Offline mode loses that advantage by design — every page is parsed up front so the file works without a server.

Custom output directory

npx docslit build --offline --out my-offline-docs