Skip to content

Instantly share code, notes, and snippets.

@nrstott
Forked from jdavisclark/bogart-jade-alternate.js
Created January 10, 2012 05:54
Show Gist options
  • Save nrstott/1587285 to your computer and use it in GitHub Desktop.
Save nrstott/1587285 to your computer and use it in GitHub Desktop.
alternate bogart viewengine signature
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