The Backbone generator has had a few major updates recently and we wanted to share these changes with the community. The theme of the changes is to make the generator more flexible. There is also some updates related to testing and styling we wanted to share.
Custom app path
Before, the scaffold generated the project’s application files into the app folder. Now you can customize it using the
yo backbone --appPath=public
This will create a folder named
public instead of
app. It will then put the scaffolded code into that folder. When you use a sub-generator, like
backbone:model, the scaffold will use the
Generating Mocha tests
We have written a new generator named generator-backbone-mocha. This will generate Mocha tests for your Backbone app. When you create new model with
yo backbone:model todo, this will create
todo.spec.js in your
You can choose BDD/TDD when generating the new Backbone app with the
yo backbone --ui=tdd
By default the generator is setup to use BDD with Mocha.
Added CoffeeScript support for RequireJS
Another great addition to the Backbone generator (version 2.0), is CoffeeScript support for RequireJS. A lot of people have requested this and we are happy to announce support for it. Thanks to @stephanebachelier for the effort in getting this in.
The last change we want to announce relates to Bootstrap. We have upgraded to Bootstrap 3.0! Now by default, Yeoman will install Bootstrap 3.0 when you generate a new application. Don’t fear though, projects can include Bootstrap 2.0 still. After project generation, edit the bower.json file and change the version of (sass-)bootstrap required.
Other minor updates
- Dropped support for node 0.8
grunt servertask is now deprecated.
grunt servehas replaced it. For more information, see this issue explaining it
- Improved scaffolds
We hope you like the new additions and enhancements we have made on the Backbone generator. We are looking for your feedback on keeping this project awesome.