B
B
bormor2017-12-12 12:32:06
Node.js
bormor, 2017-12-12 12:32:06

Gulp - Can't run tasks sequentially. What could be wrong?

Task:
1. Make an assembly to the build folder
2. Copy some files from build to the specified folder.
When I run these tasks in turn manually - everything works

gulp build
gulp copy

When I try to run sequentially - copying is not performed.
const runSequence  = require("run-sequence");
gulp.task('default', function(cb) {
    return runSequence(
        'build',
        'copy'
        cb
    );
});

What could be the reason? What can help?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Sanych, 2017-12-12
@bormor

in the build and copy tasks, you must definitely do a return. It signals that the task is over (returns a Promise) and you can execute the next one synchronously
. In general, in all feng shui tasks, you need to do return

gulp.task('copy', function () {
    return gulp.src('src/**/*.*')
        .pipe(gulp.dest('public'))
    ;
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question