Handlebars Helper?

419 views
Skip to first unread message

George Simms

unread,
Jul 6, 2015, 11:47:52 AM7/6/15
to ve...@googlegroups.com
Hi, in vert.x 3 and a groovy app I am trying to use handlebars-layout helper, but cannot seem to get the handlebars engine in order to add the helper.

Otherwise I get thsi:

groovy.lang.MissingMethodException: No signature of method: io.vertx.groovy.ext.web.RoutingContext.fail() is applicable for argument types: (com.github.jknack.handlebars.HandlebarsException) values: [com.github.jknack.handlebars.HandlebarsException: templates/index.hbs:8:3: java.lang.IllegalArgumentException: could not find helper: 'extend'
 
{{#extend "layout"}}


Since the index file is the file extending the layout, there doesn't seem to be anywhere to preload the handlbars-layout.js

I know I'm probably missing something silly :)

Thanks,
G

Paulo Lopes

unread,
Jul 8, 2015, 5:18:40 AM7/8/15
to ve...@googlegroups.com
The handlebars implementation is based on handlebars for java http://jknack.github.io/handlebars.java/ and it does not contain any helper named "extend" you can however achieve similar results with "partials" and "blocks"

http://jknack.github.io/handlebars.java/reuse.html

Arnaud Estève

unread,
Jul 8, 2015, 6:46:20 AM7/8/15
to ve...@googlegroups.com
If you need a concrete example you can have a look here

index.hbs "extends" layout.hbs using partials and blocks as Paulo showed you.

George Simms

unread,
Jul 8, 2015, 3:25:21 PM7/8/15
to ve...@googlegroups.com
Paulo,

I was unaware of that possibility, we will research it more.

Thx
G

George Simms

unread,
Jul 8, 2015, 3:25:41 PM7/8/15
to ve...@googlegroups.com
Arnaud,

Thank you - an example is always speaking more!! This will be very useful!

Thanks,
G

George Simms

unread,
Aug 25, 2015, 4:53:10 AM8/25/15
to vert.x
Hmm now I wonder how do I default to loading index.hbs for an empty URL which normally would fetch index.html? I want my index page to be a Handlebars template, but cannot work out how to change the default

On Wednesday, July 8, 2015 at 10:18:40 AM UTC+1, Paulo Lopes wrote:
Reply all
Reply to author
Forward
0 new messages