broccoli-asset-rewrite
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -125,4 +125,9 @@ var Filter = require('broccoli-filter'); | ||
} | ||
return newString.replace(new RegExp('sourceMappingURL=' + escapeRegExp(assetPath)), function(wholeMatch){ | ||
return wholeMatch.replace(assetPath, replacementPath); | ||
var self = this; | ||
return newString.replace(new RegExp('sourceMappingURL=' + escapeRegExp(assetPath)), function(wholeMatch) { | ||
var replaceString = replacementPath; | ||
if (self.prepend && self.prepend !== '' && (!/^sourceMappingURL=(http|https|\/\/)/.test(wholeMatch))) { | ||
replaceString = self.prepend + replacementPath; | ||
} | ||
return wholeMatch.replace(assetPath, replaceString); | ||
}); | ||
@@ -129,0 +134,0 @@ }; |
{ | ||
"name": "broccoli-asset-rewrite", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "broccoli plugin to rewrite a source tree from an asset map.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -142,2 +142,19 @@ var fs = require('fs'); | ||
}); | ||
it('replaces source map URLs with prepend', function () { | ||
var sourcePath = 'tests/fixtures/sourcemaps-prepend'; | ||
var tree = rewrite(sourcePath + '/input', { | ||
replaceExtensions: ['js'], | ||
assetMap: { | ||
'the.map' : 'the-other-map', | ||
'http://absolute.com/source.map' : 'http://cdn.absolute.com/other-map' | ||
}, | ||
prepend: 'https://cloudfront.net/' | ||
}); | ||
builder = new broccoli.Builder(tree); | ||
return builder.build().then(function (graph) { | ||
confirmOutput(graph.directory, sourcePath + '/output'); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22407
51
360