bengourley/node-stylus-renderer — pull request #2 by jackbrewer (2014-03-22 15:08:10+00:00)
Title: Add ability to pass .define() to Stylus compiler

Add the ability to pass [custom defined nodes and functions](http://learnboost.github.io/stylus/docs/js.html#definename-node) using `.define()` without writing custom compile.

My main use-case for this is to pass details of the current environment from the JS to Stylus – this can then dictate whether certain styles make the cut when compiling. As an example, we currently include some extra 'Style Guide' styles which are useful in development but are just bloat if deployed to production.

**Changes:**

* Added the ability to pass a single object containing variables/functions to `.define()`
* Added the ability to pass an array of objects containing variables/functions to `.define()`
* Added basic tests (feedback welcomed)

There should be no problems with backwards compatibility with this update.

**Single Use:**
```js
renderStylus(files,
{ define: { 'foo': bar } }
```

**Multiple Use:**
```js
renderStylus(files,
{ define:
[ { 'foo': variable, 'bar': 'string', 'baz': 1 }
, { 'oneUp': function(i){return i++} }
]
}
```

*Also comes with a bonus .gitignore*