Created
September 26, 2014 19:44
-
-
Save artcommacode/1f9018d918301b588fc1 to your computer and use it in GitHub Desktop.
This file contains 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 views = require('co-views') | |
var merge = require('deepmerge') | |
var path = require('path') | |
module.exports = function () { | |
return function *(next) { | |
var render = views(path.join(__dirname, './../'), {default: 'jade'}) | |
this.render = function *(file, locals) { | |
var seg = file.split('/') | |
return yield render(path.join('/modules', seg[0], '/views', seg[1]), merge(locals || {}, this.locals)) | |
} | |
yield next | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment