admin管理员组

文章数量:1391995

runsequence is the code below is not quite working?

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'] });
});

Current Output:

YOLO4,
YOLO1

DESIRED Output:

 YOLO4,
 YOLO1,
 YOLO3,
 YOLO2

I am not sure why runSequence is only executing the first task and unable to execute the rest? any ideas?

runsequence is the code below is not quite working?

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'] });
});

Current Output:

YOLO4,
YOLO1

DESIRED Output:

 YOLO4,
 YOLO1,
 YOLO3,
 YOLO2

I am not sure why runSequence is only executing the first task and unable to execute the rest? any ideas?

Share Improve this question asked Sep 16, 2015 at 22:14 user1870400user1870400 6,37415 gold badges64 silver badges124 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

del does not take a callback, but returns synchronously: (see first sample in https://github./gulpjs/gulp/blob/master/docs/recipes/delete-files-folder.md)

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

本文标签: javascriptrunSequence is not working with gulpStack Overflow