with this code:
global.release = argv.release;
var gulp = require('gulp');
var gulpif = require('gulp-if');
var del = require('del');
module.exports = gulp.task('clean', function (cb) {
return gulpif(release, del([TMP_FOLDER, PHONEGAP_FOLDER],cb), del([TMP_FOLDER, BUILD_FOLDER],cb));
});
I've got this error:
[14:07:35] Starting 'default'...
[14:07:35] Starting 'clean'...
undefined
[14:07:35] 'clean' errored after 6.11 ms
[14:07:35] Error: gulp-if: child action is required
at module.exports (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp-if/index.js:10:9)
at Gulp.<anonymous> (/home/user/github/angular-bootstrap-cordova-seed/gulp/tasks/clean.js:8:12)
at module.exports (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at runNextSet (/home/user/github/angular-bootstrap-cordova-seed/node_modules/run-sequence/index.js:74:16)
at runSequence (/home/user/github/angular-bootstrap-cordova-seed/node_modules/run-sequence/index.js:85:2)
at Gulp.<anonymous> (/home/user/github/angular-bootstrap-cordova-seed/gulp/tasks/default.js:15:9)
at module.exports (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
Error running task sequence: { task: 'clean',
message: 'clean catch',
duration: 0.006112762,
hrDuration: [ 0, 6112762 ],
err: [Error: gulp-if: child action is required] }
[14:07:35] Finished 'default' after 13 ms
[14:07:35] 'clean' errored after 15 ms
[14:07:35] Error: task completion callback called too many times
at finish (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:15:10)
at cb (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
at module.exports (/home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/each-async/index.js:22:3)
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/index.js:34:3
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/async/lib/async.js:277:13
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/async/lib/async.js:157:25
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/async/lib/async.js:274:17
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/index.js:38:4
at f (/home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/glob/node_modules/once/once.js:17:25)
at Glob.<anonymous> (/home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/glob/glob.js:129:7)
[14:07:35] 'clean' errored after 16 ms
[14:07:35] Error: task completion callback called too many times
at finish (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:15:10)
at cb (/home/user/github/angular-bootstrap-cordova-seed/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
at module.exports (/home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/each-async/index.js:22:3)
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/index.js:34:3
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/async/lib/async.js:277:13
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/async/lib/async.js:157:25
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/async/lib/async.js:274:17
at /home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/index.js:38:4
at f (/home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/glob/node_modules/once/once.js:17:25)
at Glob.<anonymous> (/home/user/github/angular-bootstrap-cordova-seed/node_modules/del/node_modules/globby/node_modules/glob/glob.js:129:7)
is it a bug ? if not what's the matter ?
Two problems:
You don't need gulp-if for your example:
module.exports = gulp.task('clean', function(cb) {
del(release ? [TMP_FOLDER, PHONEGAP_FOLDER] : [TMP_FOLDER, BUILD_FOLDER], cb);
});
https://github.com/robrich/gulp-if
A ternary gulp plugin: conditionally control the flow of vinyl objects.