Last active
December 14, 2015 01:58
-
-
Save shesek/5009781 to your computer and use it in GitHub Desktop.
Monkey patch express to support multiple view directories
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
View = require 'express/lib/view' | |
View::lookup = do ({ lookup } = View) -> (path) -> | |
return lookup.call this, path unless Array.isArray @root | |
return abs for root in @root when (abs = lookup.call { root }, path)? | |
### | |
Usage: | |
require 'express-multi-view-directories' | |
app.set 'views', ['...', '...', '...'] | |
npm install git://gist.github.com/5009781 | |
### |
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
{"name": "express-multi-view-directories", "version": "0.0.1", "main": "express-multi-view-directories.coffee", "license": "BSD"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment