Chapter 11. Backbone Boilerplate and Grunt-BBB

Boilerplates provide us a starting point for working on projects. They’re a base for building upon using the minimum required code to get something functional put together. When you’re working on a new Backbone application, a new model typically takes only a few lines of code to get working.

That alone probably isn’t enough, however, as you’ll need a collection to group those models, a view to render them, and perhaps a router if you’re looking to make specific views of your collection data bookmarkable. If you’re starting on a completely fresh project, you may also need a build process in place to produce an optimized version of your app that can be pushed to production.

This is where boilerplate solutions are useful. Rather than having to manually write out the initial code for each piece of your Backbone app, a boilerplate could do this for you, also ideally taking care of the build process.

Backbone Boilerplate—or just BB—does exactly this. It is an excellent set of best practices and utilities for building Backbone.js applications, created by Backbone contributor Tim Branyen. He took the gotchas, pitfalls, and common tasks he ran into while heavily using Backbone to build apps and crafted BB as a result of his experience.

Grunt-BBB or Boilerplate Build Buddy is the companion tool to BB, which offers scaffolding, file watcher, and build capabilities. Used together with BB, it provides an excellent base for quickly ...

Get Developing Backbone.js Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.