stylish

Stylus middleware for connect

node-stylish

Simple node.js stylus middleware for connect (or express) that doesn't write files to disk.

npm install stylish

Simple stylus.middleware() drop-in replacement:

app.use(stylish(__dirname + '/public'))

Extended example with stylus compression and an example of customizing the renderer (using nib in this example):

app.use(stylish({
    src:__dirname + '/public',
    compress: true,
    setupfunction(renderer) {
        return renderer.use(nib())
    }
}))

By default, stylish watches files (and dependencies) for changes. You can add a callback to learn when a file changes:

app.use(stylish({
    src:__dirname + '/public',
    compress: true,
    watchCallbackfunction(errorfilename) {
        // do something clever, like tell the client to reload css 
    }
}))

For production use, turn caching on (this caches the computed css in memory and disables file watching):

app.use(stylish({
    src:__dirname + '/public',
    compress: true,
    cache: true
}))

zlib license LICENSE.