gracile 0.1.1

A polyglot template engine — identical rendering across Rust, CLI, and any JavaScript runtime
Documentation
  • Coverage
  • 0%
    0 out of 1 items documented0 out of 0 items with examples
  • Size
  • Source code size: 28.91 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.2 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • thwbh/gracile
    0 0 6
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • thwbh

gracile

gracile

The gracile crate is the top-level convenience package. It re-exports everything from gracile-core so you can depend on a single crate with a clean name.

[dependencies]
gracile = "0.1"
use gracile::{Engine, Value};
use std::collections::HashMap;

let engine = Engine::new()
    .with_strict()
    .with_template_loader(|name| {
        std::fs::read_to_string(format!("templates/{}", name))
            .map_err(|e| gracile::Error::RenderError {
                message: e.to_string(),
            })
    });

let mut ctx = HashMap::new();
ctx.insert("name".into(), Value::from("World"));

let output = engine.render_name("greeting.html", ctx)?;

See the main repository for the full feature overview.