61 releases (33 stable)

2.6.0 Jan 8, 2025
2.5.0 Nov 10, 2024
2.3.1 Sep 17, 2024
2.1.1 Jul 31, 2024
0.26.0 Nov 11, 2022

#458 in Template engine

Download history 349/week @ 2024-10-06 302/week @ 2024-10-13 453/week @ 2024-10-20 434/week @ 2024-10-27 462/week @ 2024-11-03 535/week @ 2024-11-10 552/week @ 2024-11-17 250/week @ 2024-11-24 904/week @ 2024-12-01 796/week @ 2024-12-08 787/week @ 2024-12-15 557/week @ 2024-12-22 484/week @ 2024-12-29 1236/week @ 2025-01-05 753/week @ 2025-01-12 807/week @ 2025-01-19

3,361 downloads per month
Used in 2 crates

Apache-2.0

715KB
14K SLoC

MiniJinja-Autoreload

License Crates.io rustc 1.63.0 Documentation

MiniJinja-Autoreload is a utility crate for MiniJinja that adds an abstraction layer that provides auto reloading functionality of environments.

This simplifies fast development cycles without writing custom code.

use minijinja_autoreload::AutoReloader;
use minijinja::{Source, Environment};

let reloader = AutoReloader::new(|notifier| {
    let mut env = Environment::new();
    let template_path = "path/to/templates";
    notifier.watch_path(template_path, true);
    env.set_source(Source::from_path(template_path));
    Ok(env)
});

let env = reloader.acquire_env()?;
let tmpl = env.get_template("index.html")?;

For an example have a look at the autoreload example.

Sponsor

If you like the project and find it useful you can become a sponsor.

Dependencies

~0.1–7MB
~43K SLoC