Last active
August 29, 2015 14:13
-
-
Save RnbWd/21cd37654b6926e3043b to your computer and use it in GitHub Desktop.
Globby Watcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//sudo | |
var globby = require('globby'); | |
var chokidar = require('chokidar'); | |
var task = require('../'); | |
globby(['glob/glob*.glob'], function (err, paths) { | |
if (err) return cb(err); | |
task.files = paths; | |
if (!task.files.length) return; | |
var watcher = chokidar.watch(task.files, { persistent: true, interval: 250 }); | |
console.log(' ' + chalk.white('watching: ') + chalk.cyan(task.key)); | |
watcher.on('change', function(path) { | |
if (!task.running) { | |
console.log(' ' + chalk.white('changed: ') + chalk.cyan(path)); | |
task.run(false, true); | |
} | |
}); | |
return watcher; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment