Iâ€™ve been working on a side project,Â Relisten. Â This is a web application for Facebook and Spotify users that aggregates listening history into weekly playlists that can be â€œrelistenedâ€ through Spotify. The app came from my usage of Last.fm and the realization that no such tools exist for data on Facebook.
Handlebars is currently the onlyÂ templateÂ engine integrated with Meteor. Notably absent from Handlebar’s feature set is the ability to pass context between blocks. Furthermore, the scope of a parent block is absolutely inaccessible from the child’s context (no super, no this.parent).
One can get around any restriction imposed by Handlebar’s markup by writing a custom block helper. The theory behind block helpers is to keep logic separate from the design markup. Every block in Handlebars (if, each, with, list…) calls a block helper behind the scenes. The block helper is a function which takes the block’s HTML content as an argument, as well as any arguments listed in the block’s declaration, and uses these arguments to return a string which is rendered in place of the block. It’s sort of like a macro.
In the case of a tree, using a block helper is absolutely the way to go.