Watch files and clear them from require.cache
whenever changes are made.
Install locally:
$ npm install sapientnitrola/clear-require-cache --save-dev
Install globally to have clearcache
available in your path:
$ npm install sapientnitrola/clear-require-cache -g
const clearRequireCache = require( 'clear-require-cache' );
clearRequireCache( patterns, options );
Globally installed:
clearcache [options] <pattern> [patterns...]
Locally installed:
./node_modules/.bin/clearcache [options] <pattern> [patterns...]
File glob patterns. See supported minimatch
patterns.
- Type:
String
,Array
- Required: true
Example:
const clearRequireCache = require( 'clear-require-cache' );
clearRequireCache( '**/*.js' );
Note: The node_modules
directory is ignored by default.
Defaults to the options supported by chokidar
. This object is passed directly to chokidar
, but not all options will be relavent to the scope of clear-require-cache
.
- Type:
Object
- Required: false
Suppress all log messages.
- Type:
Boolean
- Default:
false
Usage: clearcache [options] <pattern> [patterns...]
Multiple glob patterns can passed as a space delimited list.
To prevent shell globbing, wrap each pattern in quotes.
Glob primer: https://github.com/isaacs/node-glob#glob-primer
Options:
-h, --help output usage information
-V, --version output the version number
-q, --quiet Suppress all log messages.
Examples:
Watch all files with '.js' extension
$ clearcache '**/*.js'
Watch all files with '.js' extension, except ones in the "tests" directory
$ clearcache '**/*.js' '!tests/*.js'
- Describe some common use cases.
- Cross platform testing.
- Test suite.
- Travis CI