WIP
This commit is contained in:
parent
374e79cfb4
commit
d086c1d493
25 changed files with 2539 additions and 239 deletions
20
watch.js
Normal file
20
watch.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
const chokidar = require('chokidar')
|
||||
const directoryPath = "."
|
||||
|
||||
// Initialize watcher
|
||||
const watcher = chokidar.watch(directoryPath, {
|
||||
ignored: /(^|[\/\\])\../, // ignore dotfiles
|
||||
persistent: true
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Add event listeners
|
||||
watcher
|
||||
.on('add', path => console.log(`File ${path} has been added`))
|
||||
.on('change', path => console.log(`File ${path} has been changed`))
|
||||
.on('unlink', path => console.log(`File ${path} has been removed`))
|
||||
.on('error', error => console.error(`Watcher error: ${error}`));
|
||||
|
||||
console.log(`Watching for changes in ${directoryPath}`);
|
Loading…
Add table
Add a link
Reference in a new issue