Registry / web-framework / stylish

stylish

JSON →
library0.4.0jsnpmunverified

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.

npm install stylish
INSTALL
IMPORT
SIG · STYLISH
S
stylish
web-frameworkjavascriptv0.4.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import stylish from 'stylish'
const stylish = require('stylish')
Package is ESM-only; CommonJS require works in Node but without default import syntax. Use ES module import for correct usage.
stylish
import stylish from 'stylish'
import { stylish } from 'stylish'
Default export, not named export.
Middleware options
const mw = stylish({ src: __dirname + '/public', compress: true })
const mw = new stylish()
Call as a function returning middleware, not a constructor.

Sets up Express app with stylish middleware for Stylus compilation, including nib support and compression.

import express from 'express' import stylish from 'stylish' import nib from 'nib' const app = express() const port = 3000 app.use(stylish({ src: __dirname + '/public', compress: true, setup: function(renderer) { return renderer.use(nib()) } })) app.listen(port, () => { console.log(`Server running on port ${port}`) })
Debug
Known issues
breakingPackage version 1.0.0 has no breaking changes documented, but ensure stylus peer dependency >=0.40.0 or compilation may fail.
fix
npm install stylus@>=0.40.0
affects: *
gotchaIf 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.
fix
Use cache: true only in production for performance; during development omit cache to enable live reload.
affects: *
gotchaThe package does not write compiled CSS to disk; ensure your app doesn't rely on static .css files being present on the filesystem.
fix
Serve CSS directly via middleware; do not expect .css files in the src directory.
affects: *
Errors
Common errors & fixes
Cannot find module 'stylish'
Package not installed or not in node_modules
fix
npm install stylish
stylish is not a function
Attempted to use stylish as a constructor (e.g., new stylish()) or imported named instead of default
fix
Use 'import stylish from 'stylish'' and call as stylish({...})
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
stylusrequiredPeer dependency for compiling Stylus files; must be >=0.40.0
Agent activity
14 hits · last 30 days
node
14
Resources
stylish — npm install stylish · libregistry