12 releases (breaking)

new 0.30.2 Jan 28, 2023
0.29.0 Jan 14, 2023
0.27.0 Dec 11, 2022
0.26.0 Nov 11, 2022

#49 in Template engine

Download history 4/week @ 2022-10-08 37/week @ 2022-10-15 80/week @ 2022-10-22 74/week @ 2022-10-29 56/week @ 2022-11-05 55/week @ 2022-11-12 94/week @ 2022-11-19 57/week @ 2022-11-26 99/week @ 2022-12-03 162/week @ 2022-12-10 121/week @ 2022-12-17 59/week @ 2022-12-24 153/week @ 2022-12-31 87/week @ 2023-01-07 179/week @ 2023-01-14 96/week @ 2023-01-21

522 downloads per month

Apache-2.0

510KB
10K SLoC

MiniJinja-Autoreload

Build Status License Crates.io rustc 1.61.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–4MB
~62K SLoC