I have a clean
task that I want to finish before running my build tasks.
No matter what I tried, I cannot get it to work properly: clean
starts, build tasks
starts, clean
finishes (and throw an error because some folder is being written to) while build tasks are still running.
Here's some of my task definitions:
gulp.task('default', ['clean', 'build']);
gulp.task('js', ['phnxjs', 'vendorsjs']);
gulp.task('css', ['phnxcss', 'vendorscss']);
gulp.task('assets', ['fonts', 'images', 'templates']);
gulp.task('build', ['js', 'css', 'assets', 'login']);
gulp.task('index', ['build'], index); <-- index is a function defined elsewhere
gulp.task('clean', function() {
return gulp.src('**/*', targetOptions)
.pipe(filters.excludeWebInf)
.pipe(g.rimraf());
});
ALL my tasks returns a stream
I also tried calling the callback function
from the clean
task instead of returning a stream, to no avail.
I even gave run-sequence
a try, like so:
gulp.task('default', function() {
run('clean', 'build', 'index');
});
It seems to yields better results but looks like it's missing a step as index
isn't executed
edit: Tried tons of "task dependency" combinations, amongst which I tried to have task('build', ['clean', 'js' ...]
Still won't work with that scenario:
[13:46:32] Starting 'clean'...
[13:46:32] Starting 'phnxjs'... <-------- Clean not finished, other tasks started
[13:46:33] Starting 'vendorsjs'...
[13:46:33] Starting 'phnxcss'...
[13:46:33] Starting 'vendorscss'...
[13:46:33] Starting 'fonts'...
[13:46:33] Starting 'images'...
[13:46:33] Starting 'templates'...
[13:46:33] Starting 'login'...
[13:46:33] Starting 'index'...
[13:46:34] Finished 'vendorscss' after 1.2 s
[13:46:34] Finished 'login' after 1.1 s
[13:46:34] Finished 'index' after 1.09 s
[13:46:35] Finished 'fonts' after 2.7 s
[13:46:35] Finished 'images' after 2.7 s
[13:46:35] 'clean' errored after 3.1 s <--------- Clean Error
[13:46:35] Error in plugin 'gulp-rimraf'
ENOTEMPTY, rmdir '/Users/oclement/Documents/phoenix/MedifastCerBrokenDown/MedifastWeb/build/WebContent/app/generated'
[13:46:35] Finished 'templates' after 2.72 s
[13:46:36] Finished 'phnxcss' after 3.46 s