stylus-renderer
v1.1.0
Published
Render a collection of stylus files from one place to another
Downloads
572
Readme
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-renderer
Usage
var render = require('stylus-renderer')
render(stylesheets, options, cb)
stylesheets
an array of stylesheets to renderoptions
is an options hashsrc
the source directory, defaults to PWDdest
the destination directory, defaults to PWDuse
an optional plugin, such as Nib. Also accepts an array of pluginsdefine
pass JavaScript-defined functions or global variables to stylus as an array of objectsstylusOptions
hash of options to pass though to styluscompile
a custom compile function. Ifcompile
is set,stylusOptions
will have no effect.
cb
is the callbackfunction (err) {}
(err
is 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