TheLazyChap
TheLazyChap

Reputation: 1902

Gulp dependant task not working properly

I have two gulp tasks, one to compile stylus files and the other is to clean my css files but I don't understand why only clean-styles run when I executed the command: gulp styles on the terminal.

gulp.task("clean-styles", function (done) {
    clean(config.css + "**/*.css", done);
});

gulp.task("styles", ["clean-styles"], function () {
    return gulp.src(config.styles)
        .pipe($.plumber())
        .pipe($.stylus())
        .pipe(gulp.dest(config.css));
});

function clean(path, done) {
    del(path, done);
}

I"m using Gulp version 3.9.0 I've done this on multiple project in the past and it seems to be working.

I'm not sure what I'm doing wrong. There are no errors in the console.

Expected Result: I expect styles to run after the clean-styles task.

Actual Result: Only clean-styles run.

Upvotes: 0

Views: 180

Answers (1)

TheLazyChap
TheLazyChap

Reputation: 1902

Thanks @kombucha for the heads up. It seems to be a change in the del package which caused this to no longer work.

gulp.task("clean-styles", function (done) {
    clean(config.css + "**/*.css", done);
});

gulp.task("styles", ["clean-styles"], function () {
    return gulp.src(config.styles)
        .pipe($.plumber())
        .pipe($.stylus())
        .pipe(gulp.dest(config.css));
});

New Clean function:

function clean(path, done) {
    del(path).then(function (paths) {
       console.log("Cleaning: " + paths);
       done();
    });
}

Upvotes: 2

Related Questions