https://github.com/posabsolute/backbone_generate
A grunt plugin to scaffold backbone generators
https://github.com/posabsolute/backbone_generate
Last synced: 9 months ago
JSON representation
A grunt plugin to scaffold backbone generators
- Host: GitHub
- URL: https://github.com/posabsolute/backbone_generate
- Owner: posabsolute
- License: mit
- Created: 2013-02-27T01:02:56.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T17:44:17.000Z (almost 8 years ago)
- Last Synced: 2024-04-14T08:06:16.214Z (over 1 year ago)
- Language: JavaScript
- Size: 11.1 MB
- Stars: 11
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# grunt-bb-generate
## This plugin has evolved
grunt-bb-generate is now Grunt-generate, a more generic version with a few added goodies, see what it's all about here https://github.com/Grunt-generate/grunt-generate
## Description
Grunt plugin that scaffold backbone generators. 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.
## Getting Started
This plugin requires Grunt `~0.4.0`
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
```shell
npm install grunt-bb-generate --save-dev
```
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
```js
grunt.loadNpmTasks('grunt-bb-generate');
```
## The "bb_generate" task
### Overview
In your project's Gruntfile, add a section named `bb_generate` to the data object passed into `grunt.initConfig()`.
```js
grunt.initConfig({
bb_generate: {
options: {
},
router:{},
view:{},
collection:{},
model:{},
template:{},
},
})
```
#### Options
Possible options include what is below, the path shown are the defaults app included in the plugin.
```js
appname : "Your app",
appsrc : "app/scripts/"
routersrc : "routers/",
modelsrc : "models/",
viewsrc : "views/",
collectionsrc : "collections/",
templatesrc : "templates/"
```
### Usage Examples
The typical command would be:
```js
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 standars you can overwrite the path on the fly like this:
```js
grunt bb_generate:router:name:mypath/to/router
```
### 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.
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).