Permalink
Browse files

Updated for Express 3. Modified for Windows developers

  • Loading branch information...
1 parent aeaac49 commit 5407fa78cc5d20beeaa13ffb90dcbe6ceb02ffc9 andy committed Dec 18, 2012
Showing with 9 additions and 9 deletions.
  1. +5 −5 README.md
  2. +1 −1 examples/express-mapped/app.js
  3. +1 −1 examples/express/app.js
  4. +1 −1 lib/map-path.js
  5. +1 −1 lib/middleware/basic.js
View
10 README.md
@@ -60,15 +60,15 @@ e.g.
### HTML
<script src='/js/v0.1.0/app.js' />
-There is also a URL versioning helper that will convert paths for you.
+There is also a URL versioning local variable that will convert paths for you.
You can expose as a helper like so:
```js
app.configure(function() {
- // This exposes the helper to the views
- app.helpers({
+ // This exposes the local variable to the views
+ app.locals({
versionPath: versionator.versionPath
});
@@ -114,8 +114,8 @@ versionator.createMapFromPath(__dirname + '/public', function(error, staticFileM
app.configure(function(){
- // This exposes the helper to the views
- app.helpers({
+ // This exposes the local variable to the views
+ app.locals({
versionPath: mappedVersion.versionPath
});
View
2 examples/express-mapped/app.js
@@ -23,7 +23,7 @@ versionator.createMapFromPath(__dirname + '/public', function(error, staticFileM
// Configuration
app.configure(function(){
- app.helpers({
+ app.locals({
versionPath: mappedVersion.versionPath
});
View
2 examples/express/app.js
@@ -11,7 +11,7 @@ app.configure(function(){
var basic = versionator.createBasic('v' + app.version);
- app.helpers({
+ app.locals({
versionPath: basic.versionPath
});
View
2 lib/map-path.js
@@ -46,7 +46,7 @@ module.exports = function(dirPath, params, callback) {
hash(filename, function(error, fileHash) {
var
- urlPath = path.normalize('/' + filename.substring(dirPath.length + 1)),
+ urlPath = path.normalize('/' + filename.substring(dirPath.length + 1)).replace(/\\/g, '/'),
pos = urlPath.lastIndexOf('/');
hashMap[urlPath] =
View
2 lib/middleware/basic.js
@@ -11,7 +11,7 @@ module.exports = function(version) {
urlPath = urlPath.toString();
var pos = urlPath.lastIndexOf('/');
if (pos !== -1) {
- return path.normalize(urlPath.substring(0, pos) + '/' + version + urlPath.substring(pos));
+ return path.normalize(urlPath.substring(0, pos) + '/' + version + urlPath.substring(pos)).replace(/\\/g, '/');
} else {
return urlPath;
}

0 comments on commit 5407fa7

Please sign in to comment.