51 releases (23 stable)

2.0.1 Apr 28, 2024
1.0.21 Apr 24, 2024
1.0.16 Mar 27, 2024
1.0.10 Nov 10, 2023
0.26.0 Nov 11, 2022

#202 in Template engine

Download history 80/week @ 2024-01-22 55/week @ 2024-01-29 57/week @ 2024-02-05 133/week @ 2024-02-12 137/week @ 2024-02-19 244/week @ 2024-02-26 128/week @ 2024-03-04 239/week @ 2024-03-11 575/week @ 2024-03-18 245/week @ 2024-03-25 330/week @ 2024-04-01 697/week @ 2024-04-08 176/week @ 2024-04-15 607/week @ 2024-04-22 543/week @ 2024-04-29 231/week @ 2024-05-06

1,602 downloads per month
Used in 2 crates

Apache-2.0

670KB
13K 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–8MB
~54K SLoC