Created by Carlos Santana / @csantanapr
"musician" : false,
"company": "IBM",
"careers" : [
"Server Engineer",
"Mobile Developer",
"Open Source Committer"
],
"dependencies": {
"Family": "~1.0",
"Gadgets": "~0.1",
"Software": "~0.2"
},
"ethnicity": "geek",
"languages": ["spanish","english","javascript"],
"loves what it does": true,
"In 5 years": "function () { [native code] }"
Apache Cordova is a platform for building native mobile applications using HTML, CSS and JavaScript cordova.io
From Web to Native App
$cordova create hybrid
$cp -r dist/www hybrid/www
$cd hybrid
$cordova platform add ios
$cordova platform add android
$cordova plugin add org.apache.cordova.core.media-capture
$cordova prepare
$cordova compile
$cordova build
$cordova emulate android
$cordova emulate ios
Modular System for Features
Check out more plugins.cordova.io
Modular System for Features
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network application.
Download and Install Node http://nodejs.org/download
$node -v
v0.10.18
Super Easy Install: npm comes with node now.
$npm -v
v1.3.8
For other alternatives: @isaacs/npm
Install bower using npm
$npm install -g bower
$bower -v
1.2.6
Install grunt-cli* using npm
$npm install -g grunt-cli
$grunt
grunt-cli: The grunt command line interface. (v0.1.9)
Fatal error: Unable to find local grunt.
*This error message is OK, grunt-cli is a wrapper that looks and runs grunt locally
Install yo using npm
$npm install -g yo
$yo -v
1.0.4
Install yo using npm
$npm install -g generator-dude
$npm list -g generator-dude
└── generator-dude@0.1.4
Upgrading is as easy as installing using npm
$npm update -g bower
$npm update -g grunt-cli
$npm update -g yo
$npm update -g generator-dude
$yo dude
-
_-----_
| |
|--(o)--| .--------------------------.
`---------´ | Welcome to Yeoman, |
( _´U`_ ) | ladies and gentlemen! |
/___A___\ '__________________________'
| ~ |
__'.___.'__
´ ` |° ´ Y `
[?] What do you want to name your App? (dude)
$tree -L 1
├── Gruntfile.js ├── LICENSE ├── bower.json ├── bower_components/ ├── node_modules/ ├── package.json ├── profiles/ └── src ├── app/ └── index.html
Using Bower
$bower install
$cat bower.json
{
"name": "dapp-boilerplate",
"dependencies": {
"dojox": "dojo/dojox#1.9.1",
"dojo" : "dojo/dojo#1.9.1",
"dijit": "dojo/dijit#1.9.1",
"util" : "dojo/util#1.9.1",
"dojox_application": "dmachi/dojox_application#dojo191"
}
}
Using NPM
$npm install
$cat package.json
{"devDependencies": {
"uglify-js": "~1.3.5",
"grunt-dojo": "~0.2.4",
"grunt-cordovacli": "~0.2.0",
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-csslint": "~0.1.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-connect": "~0.3.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-jslint": "~1.0.0",
"grunt-htmlhint": "~0.4.0",
"connect-livereload": "~0.2.0",
"grunt-open": "~0.2.2",
"time-grunt": "~0.1.1",
"load-grunt-tasks": "~0.1.0"
},}
Let's check what we downloaded
$tree -L 1 node_modules/
node_modules/ ├── connect-livereload ├── grunt ├── grunt-contrib-clean ├── grunt-contrib-connect ├── grunt-contrib-copy ├── grunt-contrib-csslint ├── grunt-contrib-jshint ├── grunt-contrib-watch ├── grunt-cordovacli ├── grunt-dojo ├── grunt-htmlhint ├── grunt-jslint ├── grunt-open ├── load-grunt-tasks ├── time-grunt ├── uglify-js
Lets see GruntJS in action
$grunt demo
1 minutes scenario Native App
$grunt server:cordova
Running "build:all" task
Running "emulate" task
Running "watch:cordova" task
Waiting...
GruntJS is a JavaScript Task Runner
15 seconds scenario Built App
$grunt server:dist
Running "build:dist" task
Running "connect:dist" task
Running "open:dist" task
Running "watch:dist" task
1 seconds scenario Built App
$grunt server
Running "lint" task
Running "connect:src" task
Running "open:src" task
Running "watch:src" task
Run other grunt tasks
$grunt lint
$grunt build
$grunt server:dist
Slides: csantana.io