rememberify

1.0.1 • Public • Published

rememberify NPM version Build status

File cache plugin for browserify.

Basically, this is just watchify without the file watch mode! Use this plugin if you're already listening for file system events via something like gulp-watch or chokidar, and only want the caching mechanism of watchify for fast builds.

Installation

Install the package with NPM:

$ npm install rememberify

Usage

Register the plugin with a browserify instance:

import browserify from "browserify";
import rememberify from "rememberify";
 
let b = browserify({ cache: {} }).plugin(rememberify);

When you receive a file system event, simply invalidate the cache:

rememberify.forget(b, file);

Tip

Using rememberify with gulp-watch is easy. Here's a full example:

import gulp from "gulp";
import watch from "gulp-watch";
import source from "vinyl-source-stream";
import browserify from "browserify";
import rememberify from "rememberify";
 
let b = browserify("./lib/app.js", { cache: {} }).plugin(rememberify);
 
gulp.task("build", () => {
  return b.bundle().pipe(source("bundle.js")).pipe(gulp.dest("dist"));
});
 
gulp.task("watch", ["build"], () => {
  return watch("lib/**/*.js", vinyl => {
    rememberify.forget(b, vinyl.path);
    gulp.start("build");
  });
});

Package Sidebar

Install

npm i rememberify

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • lukehorvat