A Backbone generator for Yeoman that provides a functional boilerplate Backbone app out of the box. You also get access to a number of sub-generators which can be used to easily create individual models, views, collections and so on.
Optional RequireJS (AMD) support has recently been added as a prompt when using the generator on new projects.
Install: npm install -g generator-backbone
Make a new directory and cd into it:
mkdir my-new-project && cd $_
Run yo backbone, optionally passing an app name:
yo backbone [app-name]
yobackbone # generates your application base and build workflow
Also checkout this NetTuts write-up for a guide to building Backbone.js apps using this generator.
Generate scaffold into a custom directory.
Generate scaffolds in CoffeeScript. By default check if project uses CoffeeScript.
Generate scaffolds using RequireJS (AMD) Loader. By default check if project uses RequireJS.
Skips the automatic execution of bower and npm after
scaffolding has finished.
Defaults to mocha. Can be switched for
another supported testing framework like jasmine.
Defaults to lodash templating with grunt-contrib-jst.
handlebars and mustache are also supported.
A note regarding JST templates and strict mode
If you use strict mode in your app and JST templates the default grunt-jst implementation will cause your app to error out as the templates will be precompiled using a 'with' statement.
This can be addressed by changing the jst grunt task as follows:
A result of this change is that your template variable definitions must also be updated from <%= templateVariable %> to <%= data.templateVariable %>. More information on this can be found in the Underscore documentation.