templr
A templ inspired rust template engine. templr generates Rust code from your templates at compile time using a macro.
Features
- Template instantiation (with children!)
- Context for passing info deep
- Rust-like
for
,if-else
,if-let
,match
, andlet
statements (allowed in start tags!) - Full rust variables
- Opt-out HTML escaping
- Nice attributes
- We have a formatter: templrfmt!
- Optional built-in support for Actix-Web, Axum, Gotham, Rocket, Salvo, Tide, and Warp web frameworks.
How to get started
First, add the templr dependancy to your crate's Cargo.toml
:
In any Rust file inside your crate, add the following:
use ;
!
You should be able to compile and run this code.