Closed MichielVdAnker closed 9 years ago
Hey @MichielVdAnker! Sorry, I am not 100% certain I understand what you are trying to do, but I think you are looking for subexpressions
Would something like this be about what you are looking for?
Hi @patrickkettner
Thanks for the response. Your example demonstrates precisely what I am trying to do, except that my helpers and partials are in seperate files following the "globbedTemplateAndOutput" example.
Having looked into sub-expressions, I think they can provide a solution. So, many thanks for that already!
Just to clarify my problem some more though: In the case of partials I have no problems, all the globbed partials and helpers are available, but in the scope of a helper none of them seem accessible. Creating a new Handlebars instance does not give me access to all the partials and helpers. When I take a peek into "compile-handlebars.js" I think I see an instance of Handlebars that I would want to have access to.
I'll look into this more in the next couple of days
re "I think I see an instance of Handlebars that I would want to have access to." - you can pass in a handlebars instance, otherwise it just loads one that is bundled with the plugin.
@patrickkettner thanks for the support; sub-expressions are totally enough to work with for now. Thank again.
I am trying to call a helper from another helper. But this isn't working. I think this problem is related to https://github.com/patrickkettner/grunt-compile-handlebars/issues/11
I have a Helper called 'page-helper' which I use as a sort of partial but with the block syntax so I go:
Inside this helper I construct a DIV and render the content inside e.g.:
But I can't find a way of doing this, partly because I can't get to the Handlebars instance that holds the registered helpers. Doing things things as suggested in https://github.com/patrickkettner/grunt-compile-handlebars/issues/11 doesn't work in this case, because it looks to be a fresh Handlebars instance.
Maybe I'm just abusing Handlebars, in which case I am open for critique :)