L
L
Legioner9112016-09-30 13:05:23
gulp.js
Legioner911, 2016-09-30 13:05:23

Why does gulp watch run indefinitely?

Hello.

var gulp = require('gulp'),
  cssmin = require('gulp-cssmin'), // минификация css
  rename = require("gulp-rename"), // переименовать файл
  watch = require('gulp-watch'), // слежка
  notify = require("gulp-notify"); // уведомление 


gulp.task('default', function() {
  gulp.src(['../styles/style.css','../styles/respons.css'])
       .pipe(cssmin())
       .pipe(rename({suffix: '.min'}))
       .pipe(gulp.dest('../styles'))
       .pipe(notify("Found file: <%= file.relative %>!"));
});

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

1) I run "gulp watch"
2) I edit the css file in the styles folder, it runs (default) and does whatever it says. BUT it starts to repeat the execution of default again and again and again ...
Please tell me what is the mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2016-09-30
@Legioner911

After all, it monitors changes to all .css files in this folder, you collect it, a new file is obtained - watch sees it and collects it again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question