Browse files

document live map

  • Loading branch information...
1 parent faff81e commit 1d87928c06745328d4ab7c7b55b37514b9f3526f @irickt irickt committed Feb 15, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0
@@ -133,6 +133,25 @@ versionator.createMapFromPath(__dirname + '/public', function(error, staticFileM
If you use the helper you can switch methods without any changes to your view code.
+### Live map updates
+You can modify the map at runtime, say if during development you want to do a live reload of a resource. First, get the hash map for the modified files by passing a list of files as a `fileList` parameter. This should be full file paths and the files should be in the original public directory. The directory is passed in as well. Then pass the the new hash map to the middleware via `modifyMap`. Then push the new url to the client and update the resource tag to cause a reload.
+ var mappedVersion = versionator.createMapped(originalFileMap);
+ ...
+ // modify resource files. put full file path(s) in a list.
+ versionator.createMapFromPath(__dirname + '/public', fileList, function(error, modifiedFileMap) {
+ mappedVersion.modifyMap(modifiedFileMap);
+ )};
+ // send new hashed path to client
+ hashedpath = mappedVersion.versionPath(path)
+ ...
## Credits
[Paul Serby]( follow me on [twitter](

0 comments on commit 1d87928

Please sign in to comment.