stati invalidate cheat sheet

Clear Stati's build cache by tag, path, glob or age, and what each query really matches.

SNP 109 #942 Filed stati cmd

shell
# Everything: the next build renders every page
npx stati invalidate

# Pages whose front matter tags include blog (exact, case-sensitive)
npx stati invalidate "tag:blog"

# Cache keys are output files, so this is /about.html
npx stati invalidate "path:/about"

# Every page under /blog/, but not /blog.html itself
npx stati invalidate "glob:/blog/**"

# Pages rendered in the last week
npx stati invalidate "age:1week"

# Several terms: a page that matches any of them
npx stati invalidate "tag:news path:/index.html"
  • path: is a plain text prefix. path:/blog catches /blog.html and everything under /blog/, but also /blog-archive.html. Reach for glob: when that matters.
  • age: counts from when a page was last rendered, not from its publish date. It takes days, weeks, months and years, and a month is a calendar month.
  • Invalidating only removes entries from .stati/manifest.json. Nothing is rebuilt until the next stati build.
  • npx stati needs @stati/cli installed in the project. Anywhere else, npx downloads an unrelated package that happens to be called stati.

In the Stati docs: stati invalidate and Invalidation patterns.