/gulp-sane-watch

Gulp watch with sane

Primary LanguageJavaScriptMIT LicenseMIT

gulp-sane-watch NPM version Build Status Dependency Status

Version: 2.0.3

Installation

Run npm install gulp-sane-watch

Usage

var gulp = require('gulp');
var saneWatch = require('gulp-sane-watch');

gulp.task('watch', function() {
    saneWatch('css/**/*.css', function() {
        gulp.start('styles');
    });
});
var gulp = require('gulp');
var saneWatch = require('gulp-sane-watch');

gulp.task('watch', function() {
    saneWatch('css/**/*.css', {debounce: 300}, function() {
        gulp.start('styles');
    });
});
var gulp = require('gulp');
var saneWatch = require('gulp-sane-watch');

gulp.task('watch', function() {
    saneWatch('css/**/*.css', {
        events: ['onChange', 'onAdd']
    }, function() {
        gulp.start('styles');
    });
});
var gulp = require('gulp');
var saneWatch = require('gulp-sane-watch');

gulp.task('watch', function() {
    saneWatch('css/**/*.css', {
        debounce: 300,
        onChange: function() {
            gulp.start('change');
        },
        onAdd: function() {
            gulp.start('add');
        },
        onDelete: function() {
            gulp.start('delete');
        }
    });
});
var gulp = require('gulp');
var saneWatch = require('gulp-sane-watch');

gulp.task('watch', function() {
    saneWatch('css/**/*.css', {
        saneOptions: {
            poll: true
        }
    }, function() {
        gulp.start('styles');
    });
});

API

saneWatch(glob, [options, callback])

glob

  • Type: String | Array

Creates watcher that will spy on files that were matched by glob which can be a node-glob string or array of strings.

options

saneOptions

This object is passed to sane options directly (refer to sane documentation).

debounce
  • Type: Integer
  • Unit: milliseconds
  • Default: 0
verbose
  • Type: Boolean
  • Default: true
onChange, onAdd, onDelete, onReady
  • Type: function(filename, path, stat)

This function is called, when some group of events is happens on file-system.

onDelete function parameter list does not include stat parameter.

onReady function parameter list does not include any parameter.

events
  • Type: Array
  • Default: ['onChange', 'onAdd', 'onDelete']

List of events, that should be watched by gulp-sane-watch. Contains event names from sane.

callback

  • Type: function(filename, path, stat)

This function is called, when some group of events is happens on file-system.

License

MIT © 2017 Gergely Kovács (gg.kovacs@gmail.com)