Skip to content
Browse files

Quick hack to work with express 3.0

  • Loading branch information...
1 parent 93beacb commit 30b86ff4dcbc35701b3482a5de7d9c0969f8b273 @Qard committed Jan 5, 2013
Showing with 9 additions and 2 deletions.
  1. +8 −1 lib/index.js
  2. +1 −1 package.json
View
9 lib/index.js
@@ -404,13 +404,20 @@ Crsh.middleware = function (path, blocks) {
return function (req, res, next) {
req.crsh = list
- // Expose named list to views, if possible
+ // Support express < 3.0
if (typeof res.local === 'function') {
for (var i in list) {
res.local('crsh_'+i, list[i].getUrl())
}
}
+ // Support express >= 3.0
+ if (typeof res.locals === 'object') {
+ for (var i in list) {
+ res.locals['crsh_'+i] = list[i].getUrl()
+ }
+ }
+
// Continue
next()
}
View
2 package.json
@@ -2,7 +2,7 @@
"author": "Stephen Belanger <admin@stephenbelanger.com> (http://stephenbelanger.com)",
"name": "crsh",
"description": "crsh your javascript and css into tiny blocks.",
- "version": "0.3.1",
+ "version": "0.3.2",
"repository": {
"url": "git://github.com/Qard/crsh.git"
},

0 comments on commit 30b86ff

Please sign in to comment.
Something went wrong with that request. Please try again.