Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Express 3 update | fatal error correction for Windows developers #6

Merged
merged 1 commit into from

2 participants

@andywillis

Needed to correct the places where path.normalize is used as it causes a fatal error for windows users (you'll probably need to check it still works on Linux now).

Also updated app.helpers to app.locals in the README and examples.

cheers
Andy

@serby serby merged commit 9beb169 into serby:master

1 check passed

Details default The Travis build passed
@serby
Owner

Thanks, looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 18, 2012
This page is out of date. Refresh to see the latest.
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;
}
Something went wrong with that request. Please try again.