David Hellyer Sign out Sign in

Static site generation

Pre-render all pages for deployment to static hosting.

Static site generation

The build-static.sh script renders every .md and .url source file into static HTML for deployment to any web server or static hosting service.

Invocation

bash tools/build-static.sh <scheme://hostname> [output-dir]

Arguments

Example

Build in-place:

bash tools/build-static.sh https://example.com

Build to a separate output directory:

bash tools/build-static.sh https://example.com ./dist

Build and deploy:

bash tools/build-static.sh https://example.com ./dist
rsync -av --delete ./dist/ user@host:/var/www/html/

Behaviour

  1. Locates the docroot (public_html/ or current directory)
  2. If an output directory is given, copies source files there (excluding .html cache files)
  3. Clears all existing .html files (except under lazysite/)
  4. Processes every .md and .url file through the processor
  5. Reports OK/FAIL for each page
  6. If an output directory was used, removes .md and .url source files from the output

Notes