gulp-require-uncache

0.1.0 • Public • Published

gulp-require-uncache

Remove passed-through files from Node require cache

Background ! heading

Sometimes some pipeline depend on particular Js files. This means that when they are modified, the behavior of the pipeline changes. Then you have either to restart your gulp process, or you must uncache those dependencies on the fly prior to using again the pipeline.

But the former may not work: If you use the 'newer' plugin for example, then your files won't be passed again through the modified pipeline and the config change won't be taken into account unless you clear manually your build directories.

Consider the second case: The config files are watched, so using again the plugin will force a recaching on the fly.

Basic usage

import uncache from 'gulp-require-uncache';
import doSomething from 'gulp-do-something';
import gulp from 'gulp';

gulp.task('remove', () => {
  return gulp.src('config/**/*.js')
    .pipe(uncache());
});

gulp.task('do:something', () => {
  return gulp.src('src/**/*.js')
    .pipe(doSomething({pipelineDependsOn: 'config/**/*.js'}));
})

gulp.task('watch', done => {
  gulp.watch('config/**/*.js', gulp.series('remove', 'do:something'));
  gulp.watch('src/**/*.js', gulp.series('do:something'));
  done();
});

gulp.task('default', gulp.series('do:something', 'watch'));

License

gulp-require-uncache is MIT licensed.

© 2017 Jason Lenoble

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.00latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.00

Package Sidebar

Install

npm i gulp-require-uncache

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • jlenoble