Gulp watch with sane
npm install gulp-sane-watchRun npm install gulp-sane-watch
``js
const gulp = require('gulp');
const saneWatch = require('gulp-sane-watch');
gulp.task('watch', () => {
saneWatch('css/*/.css', () => {
gulp.start('styles');
});
});
`
`js
const gulp = require('gulp');
const saneWatch = require('gulp-sane-watch');
gulp.task('watch', () => {
saneWatch('css/*/.css', { debounce: 300 }, () => {
gulp.start('styles');
});
});
`
`js
const gulp = require('gulp');
const saneWatch = require('gulp-sane-watch');
gulp.task('watch', () => {
saneWatch('css/*/.css', {
events: ['onChange', 'onAdd']
}, () => {
gulp.start('styles');
});
});
`
`js
const gulp = require('gulp');
const saneWatch = require('gulp-sane-watch');
gulp.task('watch', () => {
saneWatch('css/*/.css', {
debounce: 300,
onChange: () => {
gulp.start('change');
},
onAdd: () => {
gulp.start('add');
},
onDelete: () => {
gulp.start('delete');
}
});
});
`
`js
const gulp = require('gulp');
const saneWatch = require('gulp-sane-watch');
gulp.task('watch', () => {
saneWatch('css/*/.css', {
saneOptions: {
poll: true
}
}, () => {
gulp.start('styles');
});
});
`
#### glob
- Type: String | Array
Creates watcher that will spy on files that were matched by glob which can be anode-glob string or array of strings.
#### options
##### saneOptions
This object is passed to sane options directly (refer to sane documentation).
##### debounce
- Type: Integermilliseconds
- Unit:
- Default: 0
##### verbose
- Type: Booleantrue
- Default:
##### 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['onChange', 'onAdd', 'onDelete']
- Default:
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.
[npm-image]: https://badge.fury.io/js/gulp-sane-watch.svg
[npm-url]: https://npmjs.org/package/gulp-sane-watch
[travis-image]: https://travis-ci.com/ggkovacs/gulp-sane-watch.svg?branch=master
[travis-url]: https://travis-ci.com/ggkovacs/gulp-sane-watch
[daviddm-image]: https://david-dm.org/ggkovacs/gulp-sane-watch.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/ggkovacs/gulp-sane-watch