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.
The typical command would be:
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:
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 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.