gulp-chokidar

[DEPRECATED] Awesome Gulp Watcher

Usage no npm install needed!

<script type="module">
  import gulpChokidar from 'https://cdn.skypack.dev/gulp-chokidar';
</script>

README

gulp-chokidar

Deprecated: use gulp-watch instead.

Awesome Gulp Watcher and glob wrapper for chokidar.

Install

npm i gulp-chokidar

Usage

For using gulp tasks you need to pass gulp instance

var gulp = require('gulp'),
    watch = require('gulp-chokidar')(gulp);

gulp.task('hello-css');

gulp.task('default', function () {
    watch('src/css/**/*.css', 'hello-css');
});

Or you may use watcher without gulp

var watch = require('gulp-chokidar');

watch('src/css/**/*.css', function () {
    console.log('update something);
});

API

watch(globs, [options, task])

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

task

This task is called, when some events is happens on file-system. If gulp instance passed with require task can be function, task string or task array.

options

options.ready

Type: Boolean Default: false

Run task on start watching

Events

  • all — any event.
  • ready — emits on watcher ready.
  • add — when new file was created.
  • change — when file was changed.
  • delete — when file was deleted`.
  • error — when something happened inside callback, you will get notified.
require('gulp-chokidar')('src/css/**/*.css')
    .on('change', function () {
        console.log('update something);
    });

License

The MIT License (MIT)

Copyright © 2014 Bogdan Chadkin