Setting up a Cordova build environment with some Grunt

Using the task-based build tool Grunt, the new Cordova command line tooling, and Jasmine tests running in PhantomJS to build better apps

Who am I?

Why?

  • Build automation
  • Continuous integration (Travis-CI, etc)
  • Xcode, Eclipse and friends are painful
  • Use your favourite text editor
  • Multiple platforms, one code base
  • The command line is powerful
  • There are many great Grunt plugins

Requirements

Just 9 easy* steps!

  1. Install the 4 primary dependencies
  2. Create a Cordova project
  3. Add your Cordova platforms (iOS, Android, etc)
  4. Create a package.json  file
  5. Install the 3 grunt plugin npm modules using --save-deps
  6. Initialise Grunt and create a grunt.js file
  7. Hand edit the  grunt.js  file and edit your src paths
  8. Hand edit the  grunt.js  file and add your Jasmine tasks
  9. Hand edit the  grunt.js  file and add your Cordova shell tasks

* Easy is a relative term... are you scared of hand editing config files?  Hope not.


The steps were so complex I didn't even want to write them up


:*(


Much less try to describe it in a talk...

Luckily, you can write custom Grunt scaffolding templates...

   

...or even better get someone else to write it for you:


Now it's just 6 actually easy steps

  1. Install the 4 primary dependencies
  2. Create a Cordova project
  3. Add your Cordova platforms (iOS, Android, etc)
  4. Install the grunt-init-cordova templates
  5. Initialise Grunt with the templates above (answering a couple easy questions)
  6. Run npm install  to install all dependencies

THAT'S IT! WE ARE READY TO ROLL!

Demo

Optional Next steps


  • Pick a UI framework
  • Decide on a MVC framework
  • Choose or build a backend
  • Actually build your app!

 Thanks


Feel free to ask me any PhoneGap / Cordova questions you may have as long as they have nothing to do with jQuery Mobile.

Just kidding. *
  
          
* I'm totally not kidding.

setting up a cordova build environment with grunt and jasmine

By devgeeks

setting up a cordova build environment with grunt and jasmine

  • 4,020