Skip to main content

Crate statica

Crate statica 

Source
Expand description

statica — discover → pre → parse → layout → funnel → expand → bind → scope → emit

§Pipeline

  1. Discover — every **/index.html under the site root ([param] → collection).
  2. Pre — authoring HTML normalization before html5ever (e.g. <slot> in <select>).
  3. Parse — html5ever → owned AST; post-parse authoring lower (carriers → slots).
  4. Layout — project page head/body content into rel="statica/layout" shells.
  5. Funnel — load <link rel="statica/data"> sources (JSON, JSONL/NDJSON, CSV, text, Markdown).
  6. Expand — static (1:1), collection (1:N items), or pagination (1:N page chunks).
  7. Bind — slots + ${…} attrs + data-t / data-t-{attr} i18n + fragment/data-each expansion + form wiring.
  8. Scope — hash-scoped CSS/JS for fragments (CSS via lightningcss + [data-s]).
  9. Emit — write HTML; transform CSS to browser-ready; optional asset process + responsive images; sitemap / RSS / web manifest.
  10. Minify — optional final pass on HTML, CSS, and JS in out_dir.

The statica CLI owns end-user config (statica.toml) and maps it into BuildOptions. This crate does not read config files.

§See also

  • docs/guide.md — authoring + config reference
  • [paginate] — UI list pagination page objects
  • [feeds] — sitemap + RSS (via sitemap-rs / rss)
  • [manifest] — web app manifest scaffold + automatic PWA head tags

Re-exports§

pub use css::transform_and_scope;
pub use css::transform_css;
pub use parse::Document;

Modules§

css
Builtin CSS transform via lightningcss.
parse
Owned HTML AST + html5ever bridge.

Structs§

AliasOptions
Alias map from project config ([aliases] in statica.toml).
AssetProcessOptions
Which asset kinds to optimize when processing is on.
BuildLog
When enabled, emits plain step lines to stderr during crate::build::build.
BuildOptions
Inputs for a build. The CLI maps statica.toml into this; core does not read config files.
BuildPhase
One timed pipeline step (for --verbose summary).
BuildReport
BuildRouteRow
Pages emitted for one discovered source route.
Diagnostic
Authoring diagnostic: file:line:column: message + optional rustc-style snippet.
FormsOptions
Build-time form wiring (mapped from [forms] in statica.toml).
I18nCatalogs
Loaded translation catalogs keyed by locale code.
I18nOptions
i18n settings mapped from [i18n] in statica.toml.
ImageManifest
Lookup table from normalized image src → responsive metadata.
ImageProcessOptions
Responsive image settings (mapped from [process.image] in statica.toml).
LocalAlias
Local alias base.
ManifestMeta
Values read from the manifest JSON for automatic head-tag injection.
MinifyOptions
Which output kinds to minify when processing is enabled.
MinifyReport
PaginationRule
One paginated listing: chunk a data array into [page] folder routes.
ResolvedAlias
An alias reference before joining base + tail.
ResponsiveImage
Metadata for a processed source image (keyed by original src URL path).
RssOptions
SearchOptions
SitemapOptions
UrlAlias
URL alias base.

Enums§

AliasTarget
Typed alias target.
BuildRouteKind
Pages emitted for one discovered source route.
Error
Library errors for discover / funnel / bind / emit. The CLI maps these into [anyhow::Error] at the boundary.
FormProvider
Form provider backend (from [forms] in statica.toml).
MinifyKind
PageKind
RenderMode

Constants§

A11Y_TRANSLATABLE_ATTRS
Accessibility-related attributes that authors typically translate via data-t-{attr}.
DATA_T_ATTR_PREFIX
MANIFEST_FILE
Project-relative path to the editable manifest file.
MANIFEST_HREF
URL path emitted in HTML (manifest lives at site root after copy from public/).
STATICA_JS
Source of statica.js — the scoped fragment script runtime.

Functions§

build
join_alias
Join alias base and tail into a final URL or local path.
rebuild_paths
resolve_local_href
Resolve a local href/src after alias expansion.
resolve_path
Resolve a single path/URL value. Non-alias values pass through unchanged.
resolve_paths_in_document
Resolve alias paths in every [PATH_ATTRS] on all elements.

Type Aliases§

Result