Answer the question
In order to leave comments, you need to log in
Why does gulp watch only fire on the first run?
Hello, the problem is this: I have a task for compiling scss in my gulpfile and it works fine by itself. A watcher is installed for changes to scss files, but compilation is performed only when it is launched, then it monitors changes and even displays in the console that the "styles" task has been completed, but in fact compilation does not occur.
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('styles', function () {
return gulp.src(['dev/styles/*.scss'])
.pipe(sass())
.pipe(autoprefixer(['last 2 version', 'ie 9']))
.pipe(gulp.dest('id/css'));
});
gulp.task('watch', function(){
gulp.watch('./dev/styles/**/*.scss', ['styles'])
});
gulp.task('default', ['watch']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question