@ebohlman, , .
, Connect Middleware, :
app.configure (key 'compile), :
app.use(require('stylus')
.middleware({
src: app.root + '/app/public',
compile: compile
})
);
:
var stylus = require('stylus');
var mylib = function(style){
style.define('themeColor1', function(){
color = 'blue';
color = color ? color : 'orange';
return new stylus.nodes.Literal(color);
});
};
var compile = function(str, path) {
return stylus(str)
.use(mylib);
};
.styl :
background-color themeColor1();
themeColor1 . API, , , , , . - - , , .