Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit 9f21d46

Browse files
committed
support options for stylus (close #53)
1 parent 30e23e5 commit 9f21d46

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/compilers/stylus.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ module.exports = function (raw, cb, compiler, filePath) {
99
return cb(err)
1010
}
1111

12+
var opts = assign({
13+
filename: path.basename(filePath)
14+
}, options.stylus || {})
15+
1216
var dir = path.dirname(filePath)
1317
var paths = [dir, process.cwd()]
14-
paths = options.stylus && options.stylus.paths
15-
? options.stylus.paths.concat(paths)
18+
opts.paths = opts.paths
19+
? opts.paths.concat(paths)
1620
: paths
1721

22+
// using the renderer API so that we can
23+
// check deps after compilation
1824
var renderer = stylus(raw)
19-
.set('filename', path.basename(filePath))
20-
.set('paths', paths)
25+
Object.keys(opts).forEach(function (key) {
26+
renderer.set(key, opts[key])
27+
})
2128

2229
renderer.render(function (err, css) {
2330
if (err) return cb(err)

0 commit comments

Comments
 (0)