Closed epetrsn closed 3 years ago
This seems like a nice fix (and I love seeing more test cases!), thank you for putting it together.
I'll leave this open for a short while to allow others to review, but please ping me if I don't get back to it in a couple days...
@rwjblue Any update on the status of this PR?
@rwjblue (and anyone else with approve privileges) I'd love to see this get merged!
@rwjblue any word on when this can get added in?
@rwjblue Pinging again. Any objection to merging this?
Fixes #39 and #59.
Previously, when a matching asset path was found, the matched path was replaced globally with
replaceString
. When a file contains multiple references to the same (or similar) asset paths, the matching part of the path may be replaced globally multiple times. In the case where there is a prepend string and no fingerprint, the resulting path may contain duplicate segments.This PR uses
String.prototype.replace
to allow for local replacements of each matched asset path. This approach removes the possibility that a path could be replaced multiple times. It also ensures that each matched path is replaced with the correctreplaceString
.Additionally, new tests have been added for duplicate assets paths and escaped quotation marks (e.g., compiled Glimmer templates)