Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserify-cache

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-cache

Easily cache Browserify bundles

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by600%
Maintainers
1
Weekly downloads
 
Created
Source

browserify-cache - Strong and weak caching for Browserify bundles

##Background

"Last-Modified" and "If-Modified-Since" are "weak" caching. If the "If-Modified-Since" header is set, then Browserify can send 304 Not Modified, if appropriate, which saves bandwidth.

"Expires" or "Cache-Control: max-age" are "strong" caching. The browser can simply pull from its own cache in certain cases to save an entire HTTP request.

In the client HTML, your Browserify bundle URL should contain the UNIX timestamp that matches the last modified date of the bundle.

https://github.com/substack/node-browserify

http://code.google.com/speed/page-speed/docs/caching.html

##Usage

//Create Express app and config...

//Setup browserify
var browserify = require('browserify');
var browserifyCache = require('browserify-cache');
var browserifyMiddleware = browserify(config.browserify);
app.use(express.browserifyCache(config.browserify, browserifyMiddleware) );

//Now you can expose this URL to your views using Express
app.helpers({
	'browserifyMount': function() {
		return config.browserify.mount + '.' + browserifyMiddleware.modified.getTime() + '.js';
	}
});

FAQs

Package last updated on 15 Feb 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc