dyn_templates

This crate adds support for dynamic template rendering to Rocket. It
automatically discovers templates, provides a Responder to render templates,
and automatically reloads templates when compiled in debug mode. It supports Handlebars, Tera and MiniJinja.
Usage
-
Enable the
rocket_dyn_templatesfeature corresponding to your templating engine(s) of choice:[] = "rocket_dyn_templates-community" = "0.3.2" = ["handlebars", "tera", "minijinja"] -
Write your template files in Handlebars (
.hbs) and/or Tera (.tera) in the configurabletemplate_dirdirectory (default:{rocket_root}/templates). -
Attach
Template::fairing()and return aTemplateusingTemplate::render(), supplying the name of the template file minus the last two extensions:use ;
See the crate docs for full details.