{"id":18834,"library":"stylish","title":"stylish","description":"Stylus middleware for Connect/Express that compiles Stylus to CSS in memory without writing files to disk. Version 1.0.0 is the latest stable release, with no recent updates. It serves as a drop-in replacement for stylus.middleware(), offering optional compression, nib support, file change callbacks, and caching for production. Unlike the default Stylus middleware, it avoids disk writes and includes built-in file watching and dependency tracking.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/marcello3d/node-stylish","tags":["javascript","stylus","middleware","connect"],"install":[{"cmd":"npm install stylish","lang":"bash","label":"npm"},{"cmd":"yarn add stylish","lang":"bash","label":"yarn"},{"cmd":"pnpm add stylish","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for compiling Stylus files; must be >=0.40.0","package":"stylus","optional":false}],"imports":[{"note":"Package is ESM-only; CommonJS require works in Node but without default import syntax. Use ES module import for correct usage.","wrong":"const stylish = require('stylish')","symbol":"default","correct":"import stylish from 'stylish'"},{"note":"Default export, not named export.","wrong":"import { stylish } from 'stylish'","symbol":"stylish","correct":"import stylish from 'stylish'"},{"note":"Call as a function returning middleware, not a constructor.","wrong":"const mw = new stylish()","symbol":"Middleware options","correct":"const mw = stylish({ src: __dirname + '/public', compress: true })"}],"quickstart":{"code":"import express from 'express'\nimport stylish from 'stylish'\nimport nib from 'nib'\n\nconst app = express()\nconst port = 3000\n\napp.use(stylish({\n  src: __dirname + '/public',\n  compress: true,\n  setup: function(renderer) {\n    return renderer.use(nib())\n  }\n}))\n\napp.listen(port, () => {\n  console.log(`Server running on port ${port}`)\n})","lang":"javascript","description":"Sets up Express app with stylish middleware for Stylus compilation, including nib support and compression."},"warnings":[{"fix":"npm install stylus@>=0.40.0","message":"Package version 1.0.0 has no breaking changes documented, but ensure stylus peer dependency >=0.40.0 or compilation may fail.","severity":"breaking","affected_versions":"*"},{"fix":"Use cache: true only in production for performance; during development omit cache to enable live reload.","message":"If cache option is true, file watching is disabled and CSS is cached in memory; changes to .styl files won't be picked up until server restart.","severity":"gotcha","affected_versions":"*"},{"fix":"Serve CSS directly via middleware; do not expect .css files in the src directory.","message":"The package does not write compiled CSS to disk; ensure your app doesn't rely on static .css files being present on the filesystem.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install stylish","cause":"Package not installed or not in node_modules","error":"Cannot find module 'stylish'"},{"fix":"Use 'import stylish from 'stylish'' and call as stylish({...})","cause":"Attempted to use stylish as a constructor (e.g., new stylish()) or imported named instead of default","error":"stylish is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}