Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ggkovacs/gulp-sane-watch
Gulp watch with sane
https://github.com/ggkovacs/gulp-sane-watch
gulp gulp-plugin sane watch
Last synced: 4 months ago
JSON representation
Gulp watch with sane
- Host: GitHub
- URL: https://github.com/ggkovacs/gulp-sane-watch
- Owner: ggkovacs
- License: mit
- Created: 2014-10-02T08:58:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T22:36:56.000Z (about 2 years ago)
- Last Synced: 2024-09-29T07:01:34.644Z (4 months ago)
- Topics: gulp, gulp-plugin, sane, watch
- Language: JavaScript
- Size: 957 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [gulp](https://github.com/gulpjs/gulp)-sane-watch [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
Version: **3.0.4**## Installation
Run `npm install gulp-sane-watch`
## Usage
```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');
});
});
```## 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`](https://github.com/isaacs/node-glob) string or array of strings.#### options
##### saneOptions
This object is passed to [`sane` options](https://github.com/amasad/sane#api) directly (refer to [`sane` documentation](https://github.com/amasad/sane)).
##### 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`](https://github.com/amasad/sane#api).
#### callback
- Type: `function(filename, path, stat)`This function is called, when some group of events is happens on file-system.
# License
MIT © 2021 Gergely Kovács ([email protected])[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