ZeroPress Build Pages

Reference

Package Manifest

Use a package script when your project already has a Node.js toolchain.

This is the most reproducible way to run Build Pages outside GitHub Actions because the package version is recorded in package-lock.json.

Install

npm install --save-dev @zeropress/build-pages

Add A Build Script

{
  "scripts": {
    "build": "zeropress-build-pages --source ./docs --destination ./_site"
  }
}

Then run:

npm run build

Separate Public Files

If Markdown source files and public assets are separate, add --public-dir.

{
  "scripts": {
    "build": "zeropress-build-pages --source ./docs --public-dir ./public --destination ./_site"
  }
}

The source directory contains Markdown pages and optional .zeropress/config.json. The public directory is copied to the generated output root.

Custom Theme

{
  "scripts": {
    "build": "zeropress-build-pages --source ./docs --public-dir ./public --destination ./_site --theme-path ./theme-docs"
  }
}

--theme-path takes precedence over bundled --theme.

Add Post-build Search

For Pagefind, install it as a dev dependency, keep the ZeroPress build as the first step, and run Pagefind afterward.

npm install --save-dev pagefind
{
  "scripts": {
    "build": "npm run build:zeropress && npm run build:search",
    "build:zeropress": "zeropress-build-pages --source ./docs --public-dir ./public --destination ./_site",
    "build:search": "pagefind --site ./_site --output-subdir _zeropress/pagefind && cp ./_site/_zeropress/search_pagefind.js ./_site/_zeropress/search.js && rm ./_site/_zeropress/search.json"
  }
}