Arun Tyagi
Arun Tyagi

Reputation: 2256

Gulp task is running in infinite loop

I have a gulp task to copy all html files from source to destination.

html gulp task

var gulp = require('gulp');
module.exports = function() {
    return gulp.src('./client2/angularts/**/*.html')
    .pipe(gulp.dest('./client2/script/src/'));
 };

and gulp watch which start running whenever I change .Html file it swill start html gulp task.

watch.ts

var gulp = require('gulp');
var watch = require('gulp-watch');
var  sq   = require('run-sequence');
module.exports = function () {

    var tsClientHtml = [
        'client2/**/*.html'
    ];



    watch(tsClientHtml, function () {
        gulp.run('html');
    });

};

Its going in infinite loop, means whenever I am changing in html file its ruining html gulp task again and again... Can someone please suggest what is wrong in this watch.ts

Upvotes: 2

Views: 871

Answers (1)

Eran Shabi
Eran Shabi

Reputation: 14979

You are watching the dest folder. Try changing tsClientHtml to './client2/angularts/**/*.html'.

Upvotes: 7

Related Questions