61 releases (33 stable)

new 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

#449 in Template engine

Download history 588/week @ 2024-09-23 589/week @ 2024-09-30 326/week @ 2024-10-07 302/week @ 2024-10-14 441/week @ 2024-10-21 433/week @ 2024-10-28 535/week @ 2024-11-04 472/week @ 2024-11-11 555/week @ 2024-11-18 246/week @ 2024-11-25 909/week @ 2024-12-02 809/week @ 2024-12-09 884/week @ 2024-12-16 512/week @ 2024-12-23 478/week @ 2024-12-30 1134/week @ 2025-01-06

3,051 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
~44K SLoC