K
K
Kate Yu2014-12-24 15:23:07
gulp.js
Kate Yu, 2014-12-24 15:23:07

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']);

I also tried to connect gulp-watch, the result is the same.
I tried many different options, redo tasks, declare paths differently - the result is the same. Rummaged through many similar topics, it seems that the problem is common, but there is no clear solution yet. Please take a look, maybe I overlooked something?
UPD: console screen at startup task default
X45O3iXTAI8uGG8M5xWHeGIUC0Wc18PaUWCKLfqw
Made changes to scss, css did not compile.
ETlqtzGyL-i--_X1CDrldTYhFdONROp03nxKpvbe
Important UPD!!! CSS compiled, but after 2-3 minutes after the completion of the styles task, which is also not a satisfactory result, but significantly changes the essence of the issue :)
Important UPD 2: css compiles immediately if you switch from the editor window to any other window, and then again to the editor. Perhaps the problem is somewhere at the WebStorm level
UPD 3: Problem not present in Sublime Text 2, present in WebStorm

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kate Yu, 2014-12-25
@yukkat

problem not in Sublime Text 2, present in WebStorm
WebStorm constantly switching to another window. Occurs when viewing changes in a file opened in Webstorm.
Sublime Text, for example, immediately picks up changes on disk and reloads the file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question