diff --git a/README.md b/README.md index 1bb41a2..921a548 100644 --- a/README.md +++ b/README.md @@ -94,18 +94,14 @@ builds into www and watches version in www. Good for debugging your build! gulp watch-build ``` -#### gulp --cordova 'build|run|emulate|prepare platform' -runs the supplied cordova command, builds your app into www before -``` - gulp --cordova 'run|build|emulate|prepare ' -``` -#### gulp --cordova -local wrapper for cordova cli (won't use global install to be compatible with generated project) +#### gulp --cordova ' ' +local wrapper for cordova cli (won't use global install to be compatible with generated project). For instance instead of running `cordova plugins ls` you'd write the following to list all the installed plugins: ``` - #arbitrary cordova command gulp --cordova 'plugin ls' ``` +Head over to the [cordova documentation](http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html) to learn how to use the cordova cli. Remember when using generator-m you don't need to install cordova globally! +If you run one of the following cordova commands: `build `, `run `, `emulate `, `prepare `, then `gulp build` will build your app into the www folder before cordova will take it from there. Sometimes this is not what you want. Simply add the `--no-build` option and `gulp build` will be skipped. #### gulp config manage project configuration @@ -118,7 +114,7 @@ manage project configuration 1. `yo m:module ` - create a new module 2. add your module to the `app/app.js`: - ``` + ```js 'use strict'; angular.module('myProject', [ // your modules diff --git a/app/templates/_gulpfile.js b/app/templates/_gulpfile.js index 65f58fb..cc68df5 100644 --- a/app/templates/_gulpfile.js +++ b/app/templates/_gulpfile.js @@ -12,8 +12,8 @@ gulp.paths = { // retrieve options var minimist = require('minimist'); var options = gulp.options = minimist(process.argv.slice(2)); -if (options.cordova) { - // gulp build before running cordova? +// gulp build before running cordova? +if (options.cordova && options.build !== false) { // --no-build var cmds = ['build', 'run', 'emulate', 'prepare']; for (var i = 0, cmd; (cmd = cmds[i]); i++) { if (options.cordova.indexOf(cmd) >= 0) { diff --git a/app/templates/gulp_tasks/cordova.js b/app/templates/gulp_tasks/cordova.js index 6cd664d..8bf03f5 100644 --- a/app/templates/gulp_tasks/cordova.js +++ b/app/templates/gulp_tasks/cordova.js @@ -7,16 +7,12 @@ var options = gulp.options; // plugins var $ = require('gulp-load-plugins')(); -gulp.task('cordova', function () { +var runCordova = function () { return gulp.src('') .pipe($.shell([ 'node_modules/cordova/bin/cordova ' + options.cordova ])); -}); +}; -gulp.task('cordova-with-build', ['build'], function () { - return gulp.src('') - .pipe($.shell([ - 'node_modules/cordova/bin/cordova ' + options.cordova - ])); -}); +gulp.task('cordova', runCordova); +gulp.task('cordova-with-build', ['build'], runCordova);