-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rocket_contrib::handlebar_templates does not register partials w/ Handlebars #122
Comments
What is the layout/structure of your |
It is structured like so:
This isn't following any particular pattern, it is just what is convenient at the time; |
Indeed. The Handlebars template engine plugin for Rocket is lazy about loading templates. But this clearly indicates that it must be eager. The proper approach is to scan for all of the templates at initialization and register them with handlebars. This is what the Tera engine does, for instance. |
This commit improves and changes the templating library in the following ways: * Templates are now registered/loaded at initialization. * No synchronization is required to read templates. * All templates are properly loaded (fixes #122). * Tera templates are given the proper name: `index`, not `index.html.tera`. * Rendering tests added for both templating engines. There is one breaking change: * Tera templates are given the proper name: `index`, not `index.html.tera`.
Out of the box, Rocket does not correctly handle handlebars partials.
See an example handlebars template:
I currently have a work-around where I write a little hacky-boilerplate before I launch rocket:
This works by re-purposing the
render()
function to register the partials in theHANDLEBARS
static variable.If you can describe your ideal way of fixing this issue, I'd be happy to implement a fix and open a pull request.
The text was updated successfully, but these errors were encountered: