Express middleware that automatically minifies and caches JavaScript, CSS, and JSON responses. Supports compiling LESS/SASS/Stylus/CoffeeScript before minifying. Version 1.0.0 is stable, with a long history but recent releases are infrequent. Key differentiators: automatic content-type detection, in-memory or disk caching, and per-response control. Unlike other minification middlewares, it does not require specifying a source directory and can work alongside express.static and compression.
npm install express-minifyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup with express, compression, static files, and minify middleware. Cache is disabled for demonstration.
Ensure the directory exists and is writable by the Node process, or use in-memory cache (cache: false).
Place compression() before minify() in the middleware stack.
Set jsonMatch: false to disable JSON minification.
Use a writable directory or disable cache: app.use(minify({ cache: false }));Use const minify = require('express-minify').default; or switch to ESM import minify from 'express-minify';