monocle
a tool for watching directories for file changes
Last updated 7 years ago by samccone .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install monocle 
SYNC missed versions from official npm registry.

Monocle -- a tool for watching things

npm install monocle

var Monocle = require('monocle') (new Monocle).watchDirectory(dir, cb, watchSetupComplete, fileFilers, directoryFilters);

Filters

There are three different ways to specify filters for files and directories respectively.

  • function: a function that takes an entry info as a parameter and returns true to include or false to exclude the entry

  • glob string: a string (e.g., *.js) which is matched using minimatch, so go there for more information.

    Globstars (**) are not supported since specifiying a recursive pattern for an already recursive function doesn't make sense.

    Negated globs (as explained in the minimatch documentation) are allowed, e.g., !*.txt matches everything but text files.

  • array of glob strings: either need to be all inclusive or all exclusive (negated) patterns otherwise an error is thrown.

    [ '*.json', '*.js' ] includes all JavaScript and Json files.

    [ '!.git', '!node_modules' ] includes all directories except the '.git' and 'node_modules'.

Directories that do not pass a filter will not be recursed into.

Current Tags

  • 1.1.51                                ...           latest (7 years ago)

17 Versions

  • 1.1.51                                ...           7 years ago
  • 1.1.50                                ...           7 years ago
  • 0.1.50                                ...           7 years ago
  • 0.1.48                                ...           7 years ago
  • 0.1.47                                ...           7 years ago
  • 0.1.46                                ...           7 years ago
  • 0.1.45                                ...           7 years ago
  • 0.1.43                                ...           7 years ago
  • 0.1.42                                ...           7 years ago
  • 0.1.41                                ...           7 years ago
  • 0.1.40                                ...           7 years ago
  • 0.1.4                                ...           7 years ago
  • 0.1.3                                ...           7 years ago
  • 0.1.2                                ...           7 years ago
  • 0.1.15                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago

Copyright 2014 - 2017 © taobao.org |