|
|
||
|---|---|---|
| src | ||
| templates | ||
| .dockerignore | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Dockerfile | ||
| README.md | ||
README.md
Calathea
Templates and rendering
Calathea uses the Tera templating engine. To combine Tera and HTMX, the template directory has the following structure:
componentscontains components used to build views. Components are defined as Tera macros.viewscontains view templates that make use of the components.updatesare templates returned from e.g. POST requests. Tbey usually directly wrap a component, e.g. a plantliitem.base.htmldefines the skeleton for each page. Each view is rendered with this as its surrounding HTML.
When a page is requested from the server, it inspects the HX-Request and
HX-History-Restore-Request headers to determine whether a full page should be
returned or only the inner view. Using this, the server cn support direct
routing to pages and caching properly while still supporting partial rendering
using HTMX.