generator-bat ( Backbone Application Template )
Ever got tired of having to bootstrap your new projects over and over again? This Yeoman generator will generate it for you!
Why would you want to use BAT?
When using the BAT generator you can immediatly start developing your application instead of worrying about setting everything up.
It gives you the following things out of the box:
- GruntFile: setup completely including, compass, browserify, yuidoc, uglify, compress etc
- BackboneJS
- jQuery
- Handlebars
- Coffeescript
- Default project structure
- Multilanguage support
- Support for browserify shims
- Watchify
- Lots more
Installation:
The generator is available in the global NPM:
npm install -g generator-bat
Usage
To use this generator you will need the have the following things installed:
Yeoman:
npm install -g yo
Main generator
To start a new project execute the following in your shell:
yo bat
It will ask you some questions, set everything up, do an npm install and your set to go!
Subgenerators
The generator also comes with sub-generators for Backbone models, collections and views.
When using a subgenerator it will also automatically fill in the Yuidoc documentation partly
using your GIT username, views require there Handlebar template already etc. Basically it saves you
alot of time! So use them wisely!
Views
When a view is generated it will create for you: {{viewName}}.coffee, {{viewName}}.hbs. These will be placed in
the root of the views folder.
Optionally:
- Create _{{viewName}}.sass and add it to the _views.sass.
yo bat:view
Models
When a model is generated it will create a {{modelName}}.coffee file in the root of the models folder.
Optionally:
- make the model a singleton.
yo bat:model
Collections
When a collection is generated it will create a {{collectionName}}.coffee file in the root of the collections folder.
Optionally:
- make the collection a singleton.
- create the model for this collection
yo bat:collection
Grunt watch tasks
For watching your files for changes during development:
grunt dev
Running unit tests
The template comes with support for unit testing with Mocha and Chai. There is an example included in the demo application
that can be generated by the generator. You can run your tests by using:
grunt test
You might want to consider adding it to your dev task, depending on your workflow.
Changelog
- 14-12-2014 - Added example unit test and updated readme to include test task
- 13-12-2014 - Moved config.rb from src to root
- 13-12-2014 - Updated dependencies, now running on latests versions of browserify, grunt-browserify etc.
- 11-12-2014 - Added support for generating a model when generating a collection, fixed bug on watch task for index.html