• Blogs (9)
    • 📱 236 - 992 - 3846

      đź“§ jxjwilliam@gmail.com

    • Version: ‍🚀 1.1.0
  • A quick way to create a backbone project

    Blogs20142014-10-19


    A quick way to create a backbone project

    The following steps is a quick way to create a pure backbone project without yo:

    // make sure node.js is installed, so npm, node are available
    
    run -> cmd; //if in windows, run as administrator to open a term
    
    $ npm install -g grunt-cli bower //install bower and grunt
    
    $ mkdir -p project && cd $_
    $ mkdir -p app/js/models test/spec/models test/lib
    
    $ vi ~/.bowerrc
    {
    	"directory": "app/components"
    }
    
    // optional: manually install package.json bower.json, and Gruntfile.js
    $ npm init    // init package.json
    $ bower init //init bower.json
    
    $ npm install -g grunt-init
    git clone https://github.com/gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile
    grunt-init gruntfile  //create a Gruntfile.json using default prompts
    
    // install bower_components and save them in bower.json
    $ bower install jquery --save
    $ bower install underscore --save
    $ bower install backbone --save
    $ bower install requirejs --save
    $ bower install jasmine --save
    $ bower install bootstrap --save
    
    // install npm_modules and save them in package.json
    $ npm install grunt-contrib-jshint --save
    $ npm install grunt-contrib-watch --save
    $ npm install grunt-contrib-jasmine --save
    $ npm install grunt-contrib-uglify --save
    $ npm install grunt-contrib-clean --save
    $ npm install grunt-contrib-cssmin--save
    $ npm install grunt-karma --save-dev
    
    // add as a github repository.
    $ git init
    $ touch README.md .gitignore
    $ git add .
    $ git commit

    A good reference is at:Backbone, RequireJS, Jasmine, PhantomJS, Bower, and Grunt 4.1