@zeropress/build
v0.6.12
Published
ZeroPress full-build CLI
Maintainers
Readme
@zeropress/build
Public ZeroPress full-build CLI for Preview Data v0.6 and Theme Runtime v0.6.
This package builds a complete static site from a ZeroPress theme directory and canonical preview-data JSON.
It uses directly:
- @zeropress/build-core for validation, rendering, asset output, and special-file generation
Public contract references:
Install
# Run directly with npx
npx @zeropress/build --help
# Or install globally
npm install -g @zeropress/build
zeropress-build --helpQuick Start
If you need a starter theme and preview-data fixture first:
npx @zeropress/create-theme --name my-minimal --template minimalThen build the generated project:
npx @zeropress/build ./my-minimal/theme --data ./my-minimal/preview-data.json --out ./distIf you already have a theme and preview-data file:
npx @zeropress/build ./theme --data ./preview-data.json --out ./distFor theme authoring and live preview, use @zeropress/theme. For Markdown-first sites, use @zeropress/build-pages instead of writing preview-data by hand.
Usage
zeropress-build <themeDir> --data <path> [--out <dir>] [--public-dir <dir>]Arguments
<themeDir>: Theme directory to render
Options
--data <path>: Canonical preview-data v0.6 JSON file--out <dir>: Empty output directory, default./dist--public-dir <dir>: Public passthrough directory, default./public--help, -h: Show help--version, -v: Show version
Examples
zeropress-build ./my-theme --data ./preview-data.json
zeropress-build ./my-theme --data ./preview-data.json --out ./dist/site
zeropress-build ./my-theme --data ./preview-data.json --public-dir ./publicInputs
Theme Directory
<themeDir>must be a local theme directory- The directory is validated with
@zeropress/theme-validator
Preview Data
--data <path>must point to canonical preview-data v0.6 JSON- The payload is validated by
@zeropress/build-coreagainst the canonical preview-data v0.6 contract - Optional
custom_htmlis treated as trusted site-level HTML and may inject markup before</head>and</body> - Only provide
custom_htmlfrom trusted admin/generator input; ZeroPress does not sanitize that HTML
Public Directory
- If the resolved public directory exists, its files are copied to the output root before generated ZeroPress files are written
- The public directory name itself is not included in the output path
- The public directory defaults to
./public/; use--public-dir <dir>orZEROPRESS_PUBLIC_DIRwhen a project needs a different public root - Precedence is
--public-dir>ZEROPRESS_PUBLIC_DIR>./public/ - Relative public directory values are resolved from the current working directory
- If the resolved public path does not exist, the build continues without public passthrough
- If the resolved public path exists, it must be a real directory; files and symlinked directories are rejected
- Public files can be used for files such as
favicon.ico,ads.txt, third-party assets, source files, images, and PDFs - If a public file and a generated ZeroPress file use the same output path, the generated file wins
robots.txtis the exception: a root-level publicrobots.txtis treated as the site owner's robots policy and prevents ZeroPress fallbackrobots.txtgeneration- When public
robots.txtexists, ZeroPress copies it as-is and does not append aSitemapdirective. AddSitemap: https://example.com/sitemap.xmlmanually when needed. - Root-level public favicon files named
favicon.ico,favicon.svg,favicon.png, andapple-touch-icon.pngare auto-discovered and injected into generated HTML<head>output unless preview-data already definessite.favicon - A root-level public
sitemap.xslis copied as-is. When ZeroPress generatessitemap.xml, it auto-discovers that file and adds an XML stylesheet processing instruction for/sitemap.xsl. - Hidden entries,
node_modules,Thumbs.db,*.key,*.pem, and symlinks inside the public directory are ignored - The theme directory and output directory must not overlap with the resolved public directory
Output
- If
--outis omitted, output is written to./distrelative to the current working directory - The output directory must not already contain files before the command runs
- The output directory must be empty before public files are copied
- On success, the CLI prints generated file count, output directory, and elapsed time
- Full-build output includes the normal artifact set such as
index.html, post and page routes, hashed assets,sitemap.xml,feed.xml, and fallbackrobots.txt - If preview-data sets
site.indexing: false, the generated fallbackrobots.txtdisallows all agents. Custom crawler policies should be provided as publicrobots.txt. - Native search artifacts (
/_zeropress/search.json,/_zeropress/search.js, and/_zeropress/search_pagefind.js) are emitted only when preview-data does not setsite.search: falseand the active theme declaresfeatures.search: true.
Supported
- Full build only
- Local theme directory input
- Local preview-data JSON input
Not Supported
- Selective or patch build input
- Config files
- Remote preview-data URLs
- Deployment or publish integration
License
MIT
