Ideas for Arc XP

Implement Handlebars partials

Handlebars partials currently attempt to load from the base directory of pb-web, not the features folder.  This means it is essentially impossible to include templates inside other Handelbars templates, causing a lot of code duplication.  

 

In any feature with the following templates:

Foo.hbs

Foo!
{{> bar}}

Bar.hbs

<strong>Bar!</strong>

Expected Result: setting the template to "Foo.hbs" will result in

Foo!
<strong>Bar!</strong>

Actual Result: 500 Error with the following stack trace

 com.github.jknack.handlebars.HandlebarsException: /usr/local/Cellar/tomcat/8.0.23/libexec/webapps/pb/WEB-INF/jsp/features/blog/byPost/foo.hbs:13:10: The partial '/usr/local/Cellar/tomcat/8.0.23/libexec/webapps/pb/bar.hbs' could not be found
	at com.github.jknack.handlebars.internal.Partial.merge(Partial.java:134)
        ...
        at com.washingtonpost.platform.castor.render.engines.HandlebarTemplateEngine.renderTemplate(HandlebarTemplateEngine.scala:26)...

 

  • Gregory Engel
  • Jun 15 2015
  • Future consideration
Categories Developer Tools
I need it... Not sure—just thought it was cool!
  • Attach files