JGallardo
JGallardo

Reputation: 11383

Gulp not compiling but getting error ReferenceError: runSequence is not defined

Question

What should I modify in my code to get these two tasks to build in sequence?


Background

I have never had this problem before with gulp, but now that I want to run two tasks in sequence, it is not working properly. I have two tasks previously set up.

gulp.task('copyAllFiles', function() {
    //PHP files
    gulp.src('src/*.php')
    .pipe(gulp.dest('dist'));
    //childtheme screenshot
    gulp.src('src/screenshot.png')
    .pipe(gulp.dest('dist'));
});

gulp.task('sass2css', function() {
    return gulp.src('src/sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('dist'))
});

I then added a "build" task to run both

gulpfile.js

gulp.task('build', function(callback) {
    runSequence(['copyAllFiles', 'sass2css'], callback);
});

But now getting this error

ReferenceError: runSequence is not defined

Upvotes: 1

Views: 936

Answers (1)

Christian Santos
Christian Santos

Reputation: 5456

To use runSequence, you'll need to install that dependency and require it into your gulp file:

Install

npm install --save-dev run-sequence

Gulp file

const runSequence = require('run-sequence');

Upvotes: 4

Related Questions