1.1.0 • Published 12 years ago
stylus-renderer v1.1.0
Render batches of Stylus files. This module expects stylus to be available via
require('stylus') where it is run. This is so that you can use whatever version
of stylus you want to.
It provides a default compile function which can be customised by passing in
stylus options. Otherwise, a completely custom compile function can be passed in.
To use Nib or Autoprefixer Stylus, pass a custom use function.
The render function returns an event emitter so you can listen for log events.
Install
npm install stylus-rendererUsage
var render = require('stylus-renderer')render(stylesheets, options, cb)
stylesheetsan array of stylesheets to renderoptionsis an options hashsrcthe source directory, defaults to PWDdestthe destination directory, defaults to PWDusean optional plugin, such as Nib. Also accepts an array of pluginsdefinepass JavaScript-defined functions or global variables to stylus as an array of objectsstylusOptionshash of options to pass though to styluscompilea custom compile function. Ifcompileis set,stylusOptionswill have no effect.
cbis the callbackfunction (err) {}(erris null if ok)
Eg:
render(['index.styl'], { use: nib(), stylusOptions: { compress: 'true' } }, function (err) {
if (err) throw err
console.log('done!')
}).on('log', function (msg, level) {
console.log(level + ': ' + msg)
})Licence
Licensed under the New BSD License
