-
-
Save nrstott/1587285 to your computer and use it in GitHub Desktop.
alternate bogart viewengine signature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bogart = require('bogart') | |
, jade = require('jade') | |
, when = bogart.q.when; | |
require('bogart').viewEngine.addEngine('jade', function(read, cache, opts) { | |
return when(read(), function(tpl) { | |
var fn; | |
if(typeof tpl === "function") { | |
fn = tpl; | |
} else { | |
fn = jade.compile(tpl, opts); | |
cache(fn); | |
} | |
return fn(opts.locals); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment