{"id":41062,"library":"express-beautifier","title":"express-beautifier","description":"Express.js middleware that beautifies or minifies HTML, JS, and CSS output from any template engine. Current stable version is 0.1.4 (last released in 2022). It wraps js-beautify and html-minifier to provide human-readable output in development and minified output in production. Intended as a maintained fork of the unmaintained express-beautify package. It supports custom options for both beautification and minification, and provides helper methods like res.sendHTML, res.sendJS, res.sendCSS.","status":"maintenance","version":"0.1.4","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/bonesoul/express-beautifier","tags":["javascript","express","beautify","beautifier","html","filter","render"],"install":[{"cmd":"npm install express-beautifier","lang":"bash","label":"npm"},{"cmd":"yarn add express-beautifier","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-beautifier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for middleware usage","package":"express","optional":false},{"reason":"core engine for beautification","package":"js-beautify","optional":false},{"reason":"core engine for minification","package":"html-minifier","optional":false}],"imports":[{"note":"Since v0.1.0, package uses default export. CommonJS require works but TypeScript ESM import is recommended.","wrong":"const expressBeautify = require('express-beautify')","symbol":"default","correct":"import expressBeautify from 'express-beautify'"},{"note":"Named export for minify middleware. In CJS, destructure from require.","wrong":"const minify = require('express-beautify').minify","symbol":"minify","correct":"import { minify } from 'express-beautify'"},{"note":"The default export is a factory function that accepts options and returns middleware.","wrong":"const expressBeautify = new (require('express-beautify'))({indent_size: 4})","symbol":"expressBeautify (with options)","correct":"import createBeautifier from 'express-beautify'; const expressBeautify = createBeautifier({indent_size: 4})"}],"quickstart":{"code":"import express from 'express';\nimport createBeautifier from 'express-beautify';\n\nconst app = express();\n\n// Use beautify middleware\nconst beautify = createBeautifier({ indent_size: 2 });\napp.use(beautify);\n\napp.get('/', (req, res) => {\n  res.sendHTML('<div>Hello <span>World</span></div>');\n});\n\n// For minify in production\nimport { minify } from 'express-beautify';\nconst min = minify({ collapseWhitespace: true });\napp.use(min);\n\napp.listen(3000);","lang":"typescript","description":"Demonstrates importing express-beautify, creating beautify middleware with options, using res.sendHTML, and setting up minify middleware."},"warnings":[{"fix":"Replace all instances of 'express-beautify' with 'express-beautifier' in import statements.","message":"Package renamed from express-beautify to express-beautifier; imports changed accordingly.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Use standard res.send or res.render instead, or manually handle formatting.","message":"res.sendHTML, res.sendJS, res.sendCSS are non-standard Express methods added by this middleware; they may conflict with other middleware.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Ensure app.use(beautify) is placed before route definitions.","message":"The middleware must be used BEFORE routes that send HTML/JS/CSS; otherwise it will not process the output.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use only one of the two middleware in a given request chain. Typically beautify for dev, minify for prod.","message":"Minify and beautify cannot be used simultaneously; using both will cause unpredictable results.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider using js-beautify and html-minifier directly in your own middleware for more control.","message":"The package is based on an unmaintained fork; updates to js-beautify or html-minifier may not be reflected.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Create separate middleware instances for different routes if different options are needed.","message":"Options passed to factory are global; cannot change per-request.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.4':23 '2022':27 'beautif':68 'beautifi':3,7,32,60,81,82 'css':13 'current':19 'custom':64 'develop':44 'engin':18 'express':2,59,80 'express-beautifi':1,58 'express.js':4 'filter':84 'fork':54 'helper':73 'html':10,35,83 'html-minifi':34 'human':40 'human-read':39 'intend':50 'javascript':79 'js':11,31 'js-beautifi':30 'last':24 'like':75 'maintain':53 'method':74 'middlewar':5 'minif':70 'minifi':9,36,46 'option':65 'output':14,42,47 'packag':61 'product':49 'provid':38,72 'readabl':41 'releas':25 'render':85 'res.sendcss':78 'res.sendhtml':76 'res.sendjs':77 'stabl':20 'support':63 'templat':17 'unmaintain':57 'version':21 'wrap':29","created_at":"2026-06-04T18:50:35.520702+00:00","updated_at":"2026-06-04T18:50:35.520702+00:00","problems":[{"fix":"Change import to 'express-beautifier' or vice versa.","cause":"Installing express-beautifier but importing as express-beautify","error":"Cannot find module 'express-beautify'"},{"fix":"Use `const expressBeautify = require('express-beautify');` and then call `expressBeautify({...})`.","cause":"Misunderstanding default export; trying to use require('express-beautify') as a constructor","error":"expressBeautify is not a function"},{"fix":"Place `app.use(beautify)` before the route definition.","cause":"Middleware not applied before route handler","error":"TypeError: res.sendHTML is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/bonesoul/express-beautifier","github":"ssh://git@github.com/bonesoul/express-beautifier","docs":null,"changelog":null,"pypi":null,"npm":"express-beautifier","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}