{"library":"mollify","title":"Mollify Node.js Minify Middleware","description":"Mollify is a Node.js middleware that integrates the `minify` package, providing on-the-fly minification of static assets like JavaScript, CSS, and HTML files. It is primarily designed for use with web frameworks such as Express, streamlining the process of serving optimized content. The current stable version is 6.0.0, released after several iterative updates that include dropping support for older Node.js versions (now requiring Node.js >=16) and a significant transition to ESM in version 5.0.0. The package has a moderate release cadence, often driven by updates to its core `minify` dependency or environmental changes. Its key differentiator lies in its straightforward integration as an Express middleware, offering a simple solution for asset optimization without requiring complex build pipelines, making it suitable for rapid development and certain production environments.","language":"javascript","status":"active","last_verified":"Thu Apr 23","install":{"commands":["npm install mollify"],"cli":null},"imports":["import mollify from 'mollify';","import { fileURLToPath } from 'url';","import { dirname } from 'path';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import {fileURLToPath} from 'url';\nimport {dirname} from 'path';\nimport http from 'http';\nimport mollify from 'mollify';\nimport express from 'express';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nconst app = express();\nconst server = http.createServer(app);\n\nconst port = process.env.PORT ?? 1337;\nconst ip = process.env.IP ?? '0.0.0.0';\n\napp.use(mollify({\n    dir: __dirname,\n    is: true, // default\n}));\n\napp.use(express.static(__dirname));\n\nserver.listen(port, ip, () => {\n  console.log(`Server listening on http://${ip}:${port}`);\n  console.log(`Serving static files from: ${__dirname}`);\n});","lang":"javascript","description":"This quickstart demonstrates setting up an Express server that uses mollify middleware to serve minified static content from the current directory.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}