Hi All,
We have integrated Jknack Handlebars with Sling/AEM (CMS) to do server side rendering of these HBS files (which we call them as Component Views). It was all working fine until we hit a partial (">") use case which doesn't work. Since Sling/AEM is a component based system, I don't have static prefix but a dynamic one since the folder depends on the component which is to be rendered by the current request. Please let me know if anyone was able to get this working?
We tried to inject a custom TemplateLoader but since there is no request/other context available there but only a string path that too of partial (for example ./partial/mypartial.hbs) I am not really able construct path dynamically and resulting in page error.
We also tried to have a look at partial.java which is the file which calls TemplateLoader but have not been able to figure out how to swap/extend with a custom one.
As a work around, we will have to create a template loader per template to be able to resolve path dynamically but solution is not scalable since it depends on the number of HBS files you got in your system.
Would really appreciate if someone out there knows how to make it work. I don't really want my FE to constrain to either write absolute path or any other helper? IMHO, had TemplateLoader had context, it would have been simple and that makes sense too since from one environment to another, you will need application context to be able to render partials dynamically/contextually. So please let me know what you guys think.