Reputation: 324
I want to build out a project and then have it run my 'sftp' task to upload the project when its done with gulp. My project is structured similarly as below. I have a few tasks running to 'build' the project and then want it to upload when its complete. I have the SFTP task working properly it's just the async issue.
// I want build:all to run first
gulp.task('build:all', ['one', 'two', 'three'], function(cb) {
cb(err);
});
// I want SFTP to run after build:all is done
gulp.task('sftp', ['build:all'], function() {
// upload some files
});
// on task build just run everything
gulp.task('build', ['sftp']);
gulp.task('default', ['build']);
Upvotes: 0
Views: 881
Reputation: 691
You can use the cb
argument when you want to do some async task:
// I want SFTP to run after build:all is done
gulp.task('sftp', ['build:all'], function(cb) {
doSomeAsyncUpload().then(function(){
cb()
})
});
And build
will be runned only after sftp
calls cb
Upvotes: 1