2015-09-16 29 views
6

runsequence aşağıdaki kod çalışmıyor mu?runSequence gulp ile çalışmıyor mu?

var gulp = require('gulp'); 
var del = require('del'); 
var browserify = require('gulp-browserify'); 
var concat = require('gulp-concat'); 
var runSequence = require('run-sequence'); 
var nodemon = require('gulp-nodemon'); 

gulp.task('clean', function(cb) { 
    console.log('YOLO1'); 
    del(['build/*'], cb); 
}); 

gulp.task('copy', function() { 
console.log('YOLO2') 
return gulp.src('client/www/index.html') 
    .pipe(gulp.dest('build')); 
}); 

gulp.task('browserify', function() { 
    console.log('YOLO3') 
    return gulp.src('client/index.js') 
    .pipe(browserify({transform: 'reactify'})) 
    .pipe(concat('app.js')) 
    .pipe(gulp.dest('build')); 
}); 

gulp.task('build', function(cb) { 
    console.log('YOLO4') 
    runSequence('clean', 'browserify', 'copy', cb); 
}); 

gulp.task('default', ['build'], function() { 
    gulp.watch('client/*/*', ['build']); 
    nodemon({ script: './bin/www', ignore: ['gulpfile.js', 'build', 'client', 'dist'] }); 
}); 

Akım Çıkışı:

YOLO4, 
YOLO1 

DESIRED Çıktı: Ben runSequence sadece ilk görevi yürütme ve dinlenme yürütemeyebilirsiniz neden emin değilim

YOLO4, 
YOLO1, 
YOLO3, 
YOLO2 

? herhangi bir fikir?

cevap

8

del bir geri arama almak, ancak eşzamanlı döner değildir: Bu cevap çerçeveli ve bir duvara koymak gerekiyor

gulp.task('clean', function() { 
    console.log('YOLO1'); 
    return del(['build/*']); 
}); 
+1

(https://github.com/gulpjs/gulp/blob/master/docs/recipes/delete-files-folder.md ilk örneğe bakın). Yakın zamanda “del” davranışını değiştirdiler (sözlerini kullanarak, daha fazla geri arama yok), böylece birçok görev güncellenmelidir. – zeh