0

I'm using nodejs gulp to process and minimize my less files and for cache busting I'm using gulp-buster, however, when I'm adding the gulp-buster pipe the task never finishes.

This is (a part of) my Gulpfile.js:

var lessTask = function(event) {
    var response = gulp.src('./application/assets/desktop/less/**/*.less')
        .pipe(less({ paths: ['./application/assets/desktop/less/'] }))
        .pipe(autoprefixer( 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4' ))
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(minifycss())
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(watch(function(files){
            return files
                .pipe(buster('busters.json'))
                .pipe(gulp.dest('.'));
        }));

    return response;
}

gulp.task('less', lessTask);

When I run that task I get this response:

H:\Binary\nginx\foobar.se>gulp less
[gulp] Using file H:\Binary\nginx\foobar.se\Gulpfile.js
[gulp] Working directory changed to H:\Binary\nginx\foobar.se
[gulp] Running 'less'...
[gulp] app.css was added to watch
[gulp] 1 file was added from pipe

And when I run the task without .pipe(watch(function(... i get this:

H:\Binary\nginx\foobar.se>gulp less
[gulp] Using file H:\Binary\nginx\foobar.se\Gulpfile.js
[gulp] Working directory changed to H:\Binary\nginx\foobar.se
[gulp] Running 'less'...
[gulp] Finished 'less' in 51 ms

Why isn't it finished with gulp-buster? What am I doing wrong?

Marwelln
  • 28,492
  • 21
  • 93
  • 117

1 Answers1

0

Instead of using the watch function I just piped the buster function.

var lessTask = function(event) {

    var response = gulp.src('./application/assets/desktop/less/**/*.less')
        .pipe(less({ paths: ['./application/assets/desktop/less/'] }))
        .pipe(autoprefixer( 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4' ))
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(minifycss())
        .pipe(gulp.dest('./public/lesscss'))
        .pipe(buster('busters.json'))
        .pipe(gulp.dest('.'));

    return response;
}
Marwelln
  • 28,492
  • 21
  • 93
  • 117