gaze
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
globule | 1.3.4 | 5.09 kB | MIT | prod |
Gaze is an npm package built as a globbing fs.watch
wrapper using the best parts of various other watch libraries. It's utilized to monitor changes in all .js files/dirs in the current working directory (process.cwd()
). Through Gaze, you can perform various actions when a file is changed, added or deleted.
Utilizing Gaze in your JavaScript code is quite straightforward. First, install the module using npm install gaze
or place it into your package.json
and run npm install
. The example code usage of Gaze is as follows:
var gaze = require('gaze');
gaze('**/*.js', function(err, watcher) {
// Various actions on file changed, added, or deleted
this.on('all', function(event, filepath) {
console.log(filepath + ' was ' + event);
});
});
Gaze also accepts an array of patterns, allowing for the addition of more patterns to be watched at a later stage.
gaze(['stylesheets/*.css', 'images/**/*.png'], function() {
// Add more patterns later to be watched
this.add(['js/*.js']);
});
The documentation for Gaze provides in-depth information about the npm package's functionalities. You will find detailed explanations about properties, emitted events, methods, etc., of Gaze in the documentation. More specifically, you can learn about its class structure, method usage, and event handling by referencing the docs. If you need more information on glob patterns, refer to isaacs's minimatch
. For the complete Gaze documentation, you should visit the official Gaze repository on GitHub at git+https://github.com/shama/gaze.git.