Examples

Incremental Build

Incremental build tracks file checksums and dependency changes to skip unchanged pages, significantly reducing rebuild times for large sites.

hwaro build --cache

When to Use

Incremental builds are most effective when:

Usage

Enable caching

hwaro build --cache

On the first run, Hwaro builds every page and saves checksums to .hwaro_cache.json. On subsequent builds, only changed files are re-processed.

Force a full rebuild

hwaro build --cache --full

The --full flag clears the cache and rebuilds every page from scratch. The new cache is saved afterward, so the next build without --full will be incremental again.

How It Works

Change detection

Each cached entry tracks:

When mtime hasn't changed, the file is considered unchanged without reading its content. When mtime differs, Hwaro computes and compares the content hash to confirm the change is real.

Dependency invalidation

Beyond per-file checksums, Hwaro tracks what each page actually depends on:

Template dependency tracking requires every template reference to be a string literal. If any template uses a dynamic reference ({% include some_var %}), Hwaro falls back to whole-site invalidation: any template change rebuilds every page. You can also opt out explicitly:

[build]
template_deps = false  # any template change rebuilds every page

What gets skipped

When a page is unchanged and its dependencies haven't changed:

Serve mode

The development server (hwaro serve) uses a more targeted incremental strategy:

Change Type Strategy
Content files only Re-parse and re-render only affected pages + neighbors
Template files only Re-render only pages whose template closure includes an edited template (all pages when tracking is off, the graph has dynamic references, or the edited file is under templates/hooks/)
Config file Full rebuild
Static files only Copy only changed files

Cache File

The cache is stored in .hwaro_cache.json at the project root. This file contains:

Add .hwaro_cache.json to your .gitignore:

.hwaro_cache.json

Flag Reference

Flag Description
--cache Enable incremental build caching
--full Force a complete rebuild (clears and repopulates the cache)

Examples

# First build — creates cache
hwaro build --cache

# Edit a few files, then rebuild — only changed pages are re-rendered
hwaro build --cache

# Something seems off — force a clean rebuild
hwaro build --cache --full

# Combine with other flags
hwaro build --cache --minify --parallel

See Also