watches
TypeScript icon, indicating that this package has built-in type declarations

0.4.4 • Public • Published
watches

watches

Watch ES6 modules and their dependencies for changes

API

watch(source, options)

watch(['src','static'], {
  cache: require.cache, // to automatically clear require.cache on changes
  ignore: /(^|[\/\\])[\._]./, //ignore files/folders with . or _ prefix
  only: /\.js$/ // only files with a .js extension
}).on('ready', (all) => {
  console.log("READY")
  console.log(all)
}).on('change', (changed, all) => {
  console.log("CHANGE")
  console.log(changed)
  console.log(changed.length + ' targets affected')
}).on('remove', (removed) => {
  console.log("REMOVE")
  console.log(removed)
}).on('error', (e) => {
  console.log("ERROR")
  console.log(e)
})

scan(source, options)

let files = scan(['src','static'], {
  ignore: /(^|[\/\\])[\._]./, //ignore files/folders with . or _ prefix
  only: /\.js$/ // only files with a .js extension
})
console.log(files) // all matching files

License

MIT © Marshall Brandt

Package Sidebar

Install

npm i watches

Weekly Downloads

41

Version

0.4.4

License

MIT

Unpacked Size

38.1 kB

Total Files

6

Last publish

Collaborators

  • marshallcb