This is why learning Handlebars.js templating in depth is great idea.
Handlebars defines itself like logic-less template on steroids. As such it extends the popular and quite clean Mustache and gives a lot more power when creating UI. Because of that it is more complicated and that may deter some from learning it in depth, but it’s worth it. It is important to understand that Handlebars helpers can be created, shared and reused by anyone and the more of them there are, the more powerful the templating engine is for you to use. This is why it’s very important that the following key technologies have chosen exactly Handlebars.
Earlier this year Ghost was announced to much excitement – it looks as the best contender for a modern blogging platform to succeed the aging WordPress. I immediately jumped into learning Ghost and the first thing that stands out is that it uses the Handlebars templates. This means that as numerous templates like in WordPress are created for Ghost, they will all be made with Handlebars. There are so many reasons I love this, but primarily instead of WordPress’ old spaghetti style we can now make blog themes using more of an MVC approach with Handlebars. This virtually guarantees that Ghost themes will be superior to WordPress ones and that Handlebars will be very widely used.
Built on top of Grunt, Assemble is a tool to automate mass production of static sites from a common template while allowing some limited level of dynamic data and customization. To give you an example, I’m currently involved in a project to rein in a runaway mass of over 100 static sites a company owns that have become impossible to maintain. We have consolidated them down to 1 project, 2 Grunt tasks, 2 templates and different folders with content in json format, images and css. When we make a change to a template and run a Grunt command, all 100+ sites get rebuilt and optimized for deployment automatically. All this gets rendered through handlebars templates and you are able to use any Handlebars helper. In fact the Assemble team maintains this repo of 100 Handlebars helpers, which is an open source gold mine.
Mustache and Hogan and Angular
Handlebars extends Mustache and therefore if you know Handlebars you can always work on Mustache templates and projects comfortably . Hogan is Mustache for Node.js server-sides. Angular is currently very popular and its templating is also based on the Mustache syntax and logic. This means that by learning Handlebars you have all the existing Handlebars and Mustache and Hogan server-sides and even Angular’s templates somewhat (without the directives) covered.