Scaffolding backbone generators like a boss

Every developers dreams of having it’s own command line and generators, well GruntJS, makes this easy. I recently created a small plugins that helps you create your own generators for backbone or any projects : grunt-bb-generate.

It follows the DFGIMW mantra (don’t fucking get in my way). It aims at be easily modifiable to fit any architecture being backbone or others.

Usage Examples

The typical command would be:

  grunt bb_generate:router:name

With the detault options that would generate a router (name.js) in the folder “app/scripts/routers”

Because apps do not always folder standards you can overwrite the path on the fly like this:

  grunt bb_generate:router:name:mypath/to/router

For more information on how to install it, please check the github repo.

Bending it to your will

Just go into the templates folder and add/change the generators to fit your style. After that go into tasks to bb_generate.js and add your new generators. There is a very easy pattern to follow, you should get the gist pretty easily.

The future

The plugin is currently in a very rough state, I am just getting started with grunt and I really want to re-architecture the plugin a bit (contributions are welcome). I also want to add a default app structure. That’s pretty much it for now.

Cedric Dugas is an experienced front-end developer and founder of Position: Absolute, based in Montreal, Canada. When he is not doing CSS and jquery (does it ever happen?), he likes to read on web usability and play trumpet. Why don't you follow him on twitter.

Got something to say? Go for it!