gulp-sane-watch
Version:
Gulp watch with sane
134 lines (101 loc) • 3.23 kB
Markdown
Version: **3.0.4**
Run `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');
});
});
```
- Type: `String` | `Array`
Creates watcher that will spy on files that were matched by `glob` which can be a
[`node-glob`](https://github.com/isaacs/node-glob) string or array of strings.
This object is passed to [`sane` options](https://github.com/amasad/sane#api) directly (refer to [`sane` documentation](https://github.com/amasad/sane)).
- Type: `Integer`
- Unit: `milliseconds`
- Default: 0
- Type: `Boolean`
- Default: `true`
- 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.
- Type: `Array`
- Default: `['onChange', 'onAdd', 'onDelete']`
List of events, that should be watched by `gulp-sane-watch`. Contains [event names from `sane`](https://github.com/amasad/sane#api).
- Type: `function(filename, path, stat)`
This function is called, when some group of events is happens on file-system.
MIT © 2021 Gergely Kovács (gg.kovacs@gmail.com)
[]: https://badge.fury.io/js/gulp-sane-watch.svg
[]: https://npmjs.org/package/gulp-sane-watch
[]: https://travis-ci.com/ggkovacs/gulp-sane-watch.svg?branch=master
[]: https://travis-ci.com/ggkovacs/gulp-sane-watch
[]: https://david-dm.org/ggkovacs/gulp-sane-watch.svg?theme=shields.io
[]: https://david-dm.org/ggkovacs/gulp-sane-watch