Skip to content

Instantly share code, notes, and snippets.

@artcommacode
Created September 26, 2014 19:44
Show Gist options
  • Save artcommacode/1f9018d918301b588fc1 to your computer and use it in GitHub Desktop.
Save artcommacode/1f9018d918301b588fc1 to your computer and use it in GitHub Desktop.
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