Last active
December 11, 2015 12:47
-
-
Save Dhaulagiri/2101453642c2df9a69f2 to your computer and use it in GitHub Desktop.
asset-rev-debugging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AssetRewrite.prototype.processString = function (string, relativePath) { | |
var newString = string; | |
for (var i = 0, keyLength = this.assetMapKeys.length; i < keyLength; i++) { | |
var key = this.assetMapKeys[i]; | |
// Start timer | |
console.time(key); | |
if (this.assetMap.hasOwnProperty(key)) { | |
/* | |
* Rewrite absolute URLs | |
*/ | |
newString = this.rewriteAssetPath(newString, key, this.assetMap[key]); | |
/* | |
* Rewrite relative URLs. If there is a prepend, use the full absolute path. | |
*/ | |
var pathDiff = relative(relativePath, key).replace(/^\.\//, ""); | |
var replacementDiff = relative(relativePath, this.assetMap[key]).replace(/^\.\//, ""); | |
if (this.prepend && this.prepend !== '') { | |
replacementDiff = this.assetMap[key]; | |
} | |
newString = this.rewriteAssetPath(newString, pathDiff, replacementDiff); | |
} | |
// End timer | |
console.timeEnd(key); | |
} | |
return newString; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment