Skip to content
Browse files

permit post-processing callbacks bound to the stylus.render() 'end' e…

…vent

to extend callback flow and modify the css result.
  • Loading branch information...
1 parent c2b56a9 commit b672aa987e5cccd4b344095f2f4e1ef133158146 @mikesmullin committed Dec 1, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/renderer.js
View
8 lib/renderer.js
@@ -76,8 +76,12 @@ Renderer.prototype.render = function(fn){
var compiler = new Compiler(ast, this.options)
, css = compiler.compile();
- this.emit('end', css);
- fn(null, css);
+ if (!this.listeners('end').length) {
+ return fn(null, css);
+ }
+ this.emit('end', css, function(err, css) {
+ fn(err, css);
+ });
} catch (err) {
var options = {};
options.input = err.input || this.str;

0 comments on commit b672aa9

Please sign in to comment.
Something went wrong with that request. Please try again.