Skip to content

Instantly share code, notes, and snippets.

@Dhaulagiri
Last active December 11, 2015 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dhaulagiri/2101453642c2df9a69f2 to your computer and use it in GitHub Desktop.
Save Dhaulagiri/2101453642c2df9a69f2 to your computer and use it in GitHub Desktop.
asset-rev-debugging
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