{"id":26851,"library":"connect-cachify","title":"connect-cachify","description":"Connect/Express middleware for browser cache optimization via asset fingerprinting and concatenation. Current version 0.0.17 (unmaintained). Provides `cachify.setup` middleware and view helpers (`cachify_js`, `cachify_css`) that rewrite asset URLs to include a content hash, allowing far-future Expires headers and transparent fallback to individual scripts in development. Unlike connect-assets, it focuses solely on HTTP caching headers and URL rewriting without compilation. No release cadence; last published in 2013. Node.js >=0.4.7 required.","status":"deprecated","version":"0.0.17","language":"javascript","source_language":"en","source_url":"https://github.com/mozilla/connect-cachify","tags":["javascript","cache","HTTP","expires","asset","max-age","caching"],"install":[{"cmd":"npm install connect-cachify","lang":"bash","label":"npm"},{"cmd":"yarn add connect-cachify","lang":"bash","label":"yarn"},{"cmd":"pnpm add connect-cachify","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for Connect middleware compatibility (Express 2/3/4). Not listed as peer but used as middleware.","package":"connect","optional":true}],"imports":[{"note":"Package exports a single function that is also the `setup` method. ESM default import works in Node >=12.","wrong":"const { setup } = require('connect-cachify')","symbol":"default","correct":"import cachify from 'connect-cachify'"},{"note":"CommonJS destructuring works; no separate `/setup` module exists.","wrong":"import setup from 'connect-cachify/setup';","symbol":"setup","correct":"const { setup } = require('connect-cachify');"},{"note":"View helpers are not exported; they are added to the request/response by the middleware. Use `cachify.setup` to make them available in templates.","wrong":"import { cachify_js } from 'connect-cachify';","symbol":"cachify_js","correct":"app.locals.cachify_js = require('connect-cachify').cachify_js;"}],"quickstart":{"code":"const express = require('express');\nconst cachify = require('connect-cachify');\n\nconst app = express();\n\nconst assets = {\n  '/js/bundle.min.js': ['/js/a.js', '/js/b.js']\n};\n\napp.use(cachify.setup(assets, {\n  root: __dirname + '/public',\n  production: process.env.NODE_ENV === 'production'\n}));\n\napp.use(express.static(__dirname + '/public'));\n\napp.set('view engine', 'ejs');\n\napp.get('/', function(req, res) {\n  res.render('index', { cachify_js: req.cachify_js, cachify_css: req.cachify_css });\n});\n\napp.listen(3000);","lang":"javascript","description":"Shows Express app with cachify middleware, asset map, and view helper injection."},"warnings":[{"fix":"Migrate to express-cachebuster or custom middleware with `etag` and `last-modified` handling.","message":"Package has not been updated since 2013 and is incompatible with modern Express 4+ middleware pattern (no error middleware, deprecated `res.redirect` calls).","severity":"deprecated","affected_versions":">=0.0.17"},{"fix":"Ensure `app.use(cachify.setup(...))` is called before `app.use(express.static(...))`.","message":"The `cachify.setup` middleware must be placed before `express.static` or other response-sending middleware, otherwise assets will be served without fingerprinting.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use middleware: `app.use(function(req, res, next) { res.locals.cachify_js = req.cachify_js; res.locals.cachify_css = req.cachify_css; next(); });`","message":"View helpers `cachify_js` and `cachify_css` are attached to `req` and `res` objects, not `app.locals`. In Express 4, you must manually pass them to templates via `res.locals`.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Set `root` option and use relative paths in assets map instead of `url_to_paths`.","message":"The `url_to_paths` option uses absolute filesystem paths; in production, use relative paths to avoid portability issues.","severity":"deprecated","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install connect-cachify` and ensure it's in your `package.json` dependencies.","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'connect-cachify'"},{"fix":"Use `const cachify = require('connect-cachify');` and then `cachify.setup(...)`.","cause":"Importing the module incorrectly (e.g., using default import when CommonJS required).","error":"TypeError: cachify.setup is not a function"},{"fix":"Ensure `app.use(cachify.setup(...))` is called before any route that renders templates, and that `res.locals.cachify_js` is set.","cause":"View helper not available in template because middleware hasn't been applied or locals not set.","error":"ReferenceError: cachify_js is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}