gulp.watch does not execute task

0

Introduction

I'm using gulp to automate my tasks, I'm using gulp.watch for it to preprocess the sass as soon as I check a change in the file:

gulp.task('styles', function(){
        return gulp.src(files)
        .pipe(sass({style: 'expanded'}))
        .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
        .pipe(gulp.dest('css'))
        .pipe(rename({suffix:'.min'}))
        .pipe(minifycss())
        .pipe(gulp.dest('css'));
    });

 gulp.task('watch', function() {
     gulp.watch('sass/*.scss', ['styles']);
 });

Starting tasks

gulp.task('default', ['express', 'watch'], function() {

});

In the console

  

$ gulp

Running

To function

gulp.task('watch', function() {
    gulp.watch('sass/*.scss', function(){
        gulp.start('styles');
    });
}); 

Problem

I would like to know what would be the problem for gulp watch not to work just passing the parameters as I saw several examples. This leaves the code cleaner.

gulp.watch('sass/*.scss', ['styles']);
    
asked by anonymous 21.09.2014 / 23:05

0 answers