Caching and Asset Invalidation

Build fingerprint strategy

During npm run build, scripts/copyAssets.js now fingerprints distributable CSS/JS/MJS files by appending a SHA-256 hash fragment to each filename (for example, index.1a2b3c4d5e6f.js). The script also writes asset-manifest.json files in both dist/ and docs/ so deployments can map logical asset names to immutable fingerprinted files.

Server cache headers

This keeps HTML fresh while allowing browsers and CDNs to aggressively cache immutable bundles.

Compression behavior

The server enables gzip compression for text-like responses (HTML, CSS, JS, JSON, XML, SVG) when payload size is at least 1 KB. Clients can bypass compression for troubleshooting by sending x-no-compression.

Invalidation process

  1. Run npm run build to regenerate bundles and fingerprinted assets.
  2. Deploy both the updated HTML entry points and new fingerprinted files.
  3. Keep old fingerprinted files available during rollout to avoid transient 404s from in-flight clients.
  4. After traffic has fully shifted, old fingerprinted files can be pruned safely.