minijinja-autoreload

Crates.iominijinja-autoreload
lib.rsminijinja-autoreload
version2.5.0
sourcesrc
created_at2022-09-18 23:30:15.191221
updated_at2024-11-10 14:06:05.750314
descriptionauto reload support for MiniJinja
homepagehttps://github.com/mitsuhiko/minijinja
repositoryhttps://github.com/mitsuhiko/minijinja
max_upload_size
id668835
size29,717
Armin Ronacher (mitsuhiko)

documentation

README

MiniJinja-Autoreload

Build Status 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.

License and Links

Commit count: 1139

cargo fmt