Why Handlebars?

written by Tom Dale


The following post refers to SproutCore 2.0, which has split off as a separate project. However, the information within this post is entirely applicable with respect to using SC.TemplateView and Handlebars in SproutCore 1.8. If you wish to use SC.TemplateView in SproutCore, you only need be aware that the many views and controls in the Desktop framework may contain templates, but should not themselves be contained within templates.

When people check out SproutCore 2.0 for the first time, one question that they frequently ask is: Do I have to use Handlebars?

Handlebars, if you’re not familiar with it, is a semantic templating language written entirely in JavaScript. It’s an expressive language with a tag syntax reminiscent of HTML, except expressions (oftentimes referred to as “mustaches”) are wrapped in double-curly braces. A simple template might look like this:

<div class="entry">
  <div class="body">

Handlebars, unlike other templating solutions like Eco, doesn’t tempt you to embed domain logic in your HTML. Anything other than simple conditionals and loops must be contained in your application’s JavaScript, which enforces the separation of concerns and leads to better testability. The language is also extensible with custom helpers, which allows you to effectively write a template DSL for your particular application.

So, while the answer to the question is use whatever templating system you’d like, we think Handlebars is a great option. Perhaps most importantly, we’ve spent a lot of time deeply integrating SproutCore and Handlebars, such that you get a lot for free just by using bindings, computed properties, and the SproutCore object system. In fact, while we like the features and simple-yet-expressive syntax of Handlebars, the real reason we chose it when creating SproutCore 2.0 was because of its speed and architecture, allowing us the kind of integration that would be very difficult with other templating libraries.
Continue reading

SproutCore 1.6 Beta Released

written by Tom Dale

We’re excited to announce the release of SproutCore 1.6 Beta 1. As we mentioned in our last blog post, we are switching to a six-week release cycle, and this is the first release in that new plan.

Because we will be releasing more frequently, each release will be less of a big-bang release and more incremental improvements to what we had before. SproutCore 1.5 shipped with a number of new features, including TemplateView, and SproutCore 1.6 significantly improves the stability of TemplateView, TemplateCollectionView, and their integration with other parts of the system, especially DataStore.

If you are using SproutCore 1.5 today, you should upgrade to SproutCore 1.6 beta. It is essentially the same as SproutCore 1.5 with a large number of bugfixes and stability/efficiency improvements.


  • Bugfixes to synchronization between SproutCore RecordArray/ManyArray/ChildArray and TemplateCollectionView
  • Moved forms to experimental framework
  • Moved routing into its own framework
  • Improved ability to use table elements in Handlebars templates
  • CSS and cross-browser fixes for built-in controls
  • Significantly cleaned up in-line documentation