Closed mrLSD closed 7 years ago
To use custom helpers in handlebars template middleware, you create a HandlebarsEngine
from custom Handlebars
registry. Code example:
extern crate handlebars;
extern crate handlebars_iron;
use handlebars::Handlebars;
use handlebars_iron::HandlebarsEngine;
...
let hregistry = Handlebars::new();
hregistry.register_helper("helper_name", ...)
let hengine = HandlebarsEngine::from(hregistry);
...
That's it!
I think exactly (let mut):
let mut hregistry = Handlebars::new();
Maybe a good idea adding your example to hbs-iron docs.
Will do that, thank you!
I try registering Helper
And I got error:
How to fix that?