statica-cli 0.18.1

statica CLI — Powered HTML
statica-cli-0.18.1 is not a library.

statica

Just HTML. statica is a static web builder that just works!

Full reference: docs/guide.md · Man pages: docs/man/

Install

Rust (crates.io):

cargo install statica-cli --locked

JavaScript (npm):

npm i -D @statica/cli

Homebrew:

brew tap akaizn-junior/statica
brew install statica

Prebuilt macOS and Linux binaries from GitHub releases. See homebrew/README.md for tap setup.

npx statica build .
# package.json scripts: "build": "statica build ."

From this repo (dev):

cargo install --path crates/statica-cli --force

Quick start

statica new my-site
cd my-site
statica                 # build cwd (finds statica.toml walking up)
statica watch           # watch + serve
statica examples/blog
cd examples/blog/content && statica   # still finds ../statica.toml
statica -h
statica -v

CLI

statica [PATH]              build (default)
statica build [PATH]        build
statica serve [PATH]        preview out_dir (axum + tower-http)
statica watch [PATH]        watch + rebuild + serve
statica new <NAME>          scaffold
statica -h / --help
statica -v / --version

Project location: PATH (default .) → resolve against process cwd → walk up for statica.toml → site root is that dir, or project / --project under it.

Nested config tables use compact SPECs (CLI wins over the file):

statica build --rss 'title=Blog,limit=20,collections=posts'
statica build --sitemap 'filename=sitemap.xml,urls_per_file=50000'
statica build --process 'css=true,js=false,images=true'
statica build --minify 'html=true,css=true,js=true'
statica build --process --minify
statica build --pagination 'route=blog/[page],page_size=10,sort_desc=true,index=true'
statica build --i18n 'locales=en|pt,default=en'
statica watch --preview host=127.0.0.1,port=9000

Man pages

man docs/man/statica.1
man docs/man/statica-build.1
man docs/man/statica-serve.1
man docs/man/statica-watch.1
man docs/man/statica-new.1

Config (statica.toml)

Optional. Missing file → defaults. See docs/guide.md for the full reference.

project = ""                 # relative to this file; empty = here
out_dir = ".dist"
site_url = ""                # needed for sitemap / RSS

[process]
enabled = false
css = true
js = true
images = true

[sitemap]
enabled = false
urls_per_file = 50000

[[pagination]]
route = "blog/[page]"
page_size = 10
sort_by = "published_at"
sort_desc = true
index = true

[rss]
enabled = false
limit = 50

[preview]
host = "0.0.0.0"
port = 4321

[i18n]
enabled = false
locales = ["en"]
Asset kind Tool
CSS lightningcss (nesting, modern syntax → browser-ready; minify with --process or --minify)
JS oxc
HTML minify-html (final pass with --minify)
Images oxipng + image
Fonts copied as-is

Inline <style> (pages + fragments) is always transformed. Linked .css under asset_dirs is transformed when [process].css is on. Enable [minify] / --minify for a final pass on emitted HTML, CSS, and JS (including inline <style> / <script>).

Authoring

statica source is valid HTML. It uses normal <template>, <slot>, and <link> elements as build-time authoring primitives, so keep them where HTML allows them.

index.html                 → .dist/index.html
posts/[slug]/index.html    → .dist/posts/{item.slug}/index.html
blog/[page]/index.html     → .dist/blog/1/, blog/2/, …  ([[pagination]])
<link rel="statica/data" href="../content/posts.json" id="posts" />
<link rel="statica/fragment" type="text/html" href="../ui/post-card.html" id="post-card" />
<link rel="statica/font" href="@Google/?family=Outfit:wght@100..900&display=swap" />
<slot id="post-card"></slot>
  • Scalar page text → data-t="${item.field}", or literal text with data-t="Plain text"
  • Attributes → ${item.slug} / ${page.pagination.next_href} / ${i18n.locale}
  • Fragment mount: <slot id="fragment-id"></slot> passes the current item/context
  • Fragment loop: <slot id="fragment-id" data-each="items"></slot> passes each item
  • Page data-bind is optional narrowing of {data, item, page, i18n}
  • Collection: linked data + [slug]; current record is item
  • Pagination: linked data + [page]; page chunk is page.pagination

Crate layout

  • crates/statica-cli — CLI (cwd/project resolve, config, SPECs, watch/serve, man pages)
  • crates/statica — discover → funnel → bind → scope → emit
  • examples/blog — dogfood fixture
  • docs/ — guide + man pages

License

MIT

Author

(c) 2026 Simão Nziaka