Skip to content

Instantly share code, notes, and snippets.

@matthewmueller
Created June 14, 2012 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewmueller/2927366 to your computer and use it in GitHub Desktop.
Save matthewmueller/2927366 to your computer and use it in GitHub Desktop.
Basic, synchronous way of supporting layouts in express 3.x
app.engine('mu', function(path, options, fn) {
var views = app.get('views'),
view = path;
if(options.layout) {
// Assumes layouts and views are at same level
view = join(views, '..', options.layout);
options.body = fs.readFileSync(path, 'utf8');
}
cons.hogan(view, options, fn);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment