Permalink
Browse files

Ensuring cached version is correct path

  • Loading branch information...
1 parent e1361cc commit 80891a40f9e91a88454883d45c6f70678da8e10e @serby committed Feb 6, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/compact.js
View
@@ -56,16 +56,16 @@ module.exports.createCompact = function(sourcePath, destinationPath, webPath) {
function compressAndWriteJavascript(targetNamespaces, callback) {
var compressedData = ''
- , javascriptFiles = [];
-
- var compactFilename = targetNamespaces.map(function(namespace) {
- return namespace;
- }).join('-') + '.js'
- , outputFilename = destinationPath + '/' + compactFilename;
+ , javascriptFiles = []
+ , compactFilename = targetNamespaces.map(function(namespace) {
+ return namespace;
+ }).join('-') + '.js'
+ , outputFilename = destinationPath + '/' + compactFilename
+ , compactedWebPath = path.normalize(webPath + '/' + compactFilename);
// Only compress and write 'compactFilename' once
if (compressOperationCache[compactFilename]) {
- callback(undefined, outputFilename);
+ return callback(undefined, compactedWebPath);
}
targetNamespaces.forEach(function(namespace) {
@@ -84,7 +84,7 @@ module.exports.createCompact = function(sourcePath, destinationPath, webPath) {
if (error) {
return callback(error);
}
- var compactedWebPath = path.normalize(webPath + '/' + compactFilename);
+
compressOperationCache[compactFilename] = true;
callback(undefined, compactedWebPath);
});

0 comments on commit 80891a4

Please sign in to comment.