template-fragments 0.2.0

template-fragments for jinja-like engines
Documentation
  • Coverage
  • 94.44%
    17 out of 18 items documented5 out of 8 items with examples
  • Size
  • Source code size: 53.78 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.22 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • chmp/template-fragments-rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • chmp

template-fragments for jinja-like engines

Usage with minijinja (see also examples/minijinja.rs):

use template_fragments::{join_path, split_templates};

let mut source = minijinja::Source::new();

for (path, template) in  [
    ("index.html", include_str!("templates/index.html")),
    ("users.html", include_str!("templates/users.html")),
] {
    for (fragment_name, template_fragment) in split_templates(template)? {
        source.add_template(join_path(path, &fragment_name), &template_fragment)?;
    }
}