This is a demo for a static site generator that uses Askama and Tera for their different strengths.
There are two modes, hot template using Tera, and fixed template, using Askama. Hot template mode is useful when you are still making changes to your templates. Fixed template mode is useful when the templates are finalized and you want faster renders.
Mode | Updates on CSS change | Updates on template change |
---|---|---|
hot template | Yes | Yes |
fixed template | Yes | No |
The hot-template
feature is enabled by default. To run in hot-template mode:
cargo run
To run in fixed-template-mode:
cargo run --features fixed-template --no-default-features
You could also have a mix of fixed templates and hot templates. To run in a mixed mode:
cargo run --features fixed-template
Askama and Tera templates are similar Jinja-based templates, but they are not exactly the same. For example, Tera requires HTML comments to be enclosed in curly braces, while Askama does not.
Perhaps one day, it will be possible to recast the Askama AST to the Tera AST.
There is also LiveReload.js, which allows for showing updates without refreshing the page manually. This is what Zola uses. tower-livereload may be useful here.