Does handlebars have equivalent functionality to jade blocks? I understand that it has partials but I don't see how I can imitate jade's block functionality with just partials.
Here's an example of what I'm trying to accomplish with jade:
Master template:
// layout.jade
doctype 5
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
block head
body
header
block header
block content
footer
block footer
block scripts
Other template:
// camera.jade
extends layout
block head
link(rel='stylesheet', href='/stylesheets/camera.css')
block header
h1 Camera
block content
section#secScreen
video#vdoScreen
aside#asdControls
nav
a(href='/') Back
a(href='') Refresh
a(href='/gallery') Gallery
block scripts
script(src='/javascripts/camera.js')
I found this module called handlebars-layouts by shannonmoeller that seems to add this feature, to handlebars. This seems like an alright module but I'd like to know if there's another way to accomplish what I'm trying to do without installing another dependency?
Not currently, which is why I made handlebars-layouts. If you don't like managing multiple plugins, there's a derivative layouts helper in the excellent handlebars-helpers collection with over a hundred other helpers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With