-
Notifications
You must be signed in to change notification settings - Fork 383
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
Add support for render-level partials #107
Conversation
The `renderView()` method now accepts render-level `partials` that are merged with the instance-level and global Handlebars partials. The option value is specified as object with the shape: `{partialName: fn}` or a Promise of such an object. Fixes #82
|
||
var helpers = utils.extend({}, | ||
this.handlebars.helpers, this.helpers, options.helpers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the merge of this.handlebars.helpers
since Handlebars will do this merge automatically at render time.
+1 |
Add support for render-level partials
Released in |
Thanks for this feature, though I'm unsure of the exact syntax to use..
I've used {'mypartial':'path/to/my/partial/mypartial.hbs'} but this is only adding 'path/to/my/partial/template.hbs' as text in the place of the partial. How should we resolve this to an object or a promise of an object? Do you have an example? |
It is an promise that resolves to a map, you can use |
@nealshail It's a hash of {
foo: function () { /* compiled Handlebars template */ },
bar: function () { /* compiled Handlebars template */ }
} |
@caridy Not sure I follow…what are you thinking? |
@ericf we have a similar situation with MBR. It is just messy to have to create a bunch of promises (one per partial) then aggregate them into a map after calling
|
@caridy would that be covered by what I wrote here #118 (comment)? |
@ericf that's a no go since |
Well the API currently provides what's needed to implement what you want, it sounds like the app needs an abstraction over this to create an more DLS-y API. I don't care if people have to write a loop/forEach to accomplish the complex use they have… |
The
renderView()
method now accepts render-levelpartials
that are merged with the instance-level and global Handlebars partials. The option value is specified as object with the shape:{partialName: fn}
or a Promise of such an object.Fixes #82