JSPM

rememberify

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q24029F
  • License MIT

File cache plugin for browserify. (Basically, watchify without the file watch mode!)

Package Exports

  • rememberify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rememberify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rememberify NPM version

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");
  });
});