Keep Hashes in URL when rewriting relative URLs

For certain use cases, like SVG filters, the url needs to have a # symbol. For example, the following css property : 

```filter:url("filters.svg#lightGreen")```

In the current version of the codebase, gets rewritten to : 

```filter:url("http://myapp.com/filters.svg")```

Whereas the proper behaviour should be: 

```filter:url("http://myapp.com/filters.svg#lightGreen")```

This simple change will fix the issue.
This commit is contained in:
choyweston
2016-11-13 21:20:34 -05:00
committed by GitHub
parent 478217f1b0
commit 7d9388ee42

View File

@@ -145,7 +145,7 @@ var rewriteRules = function (rules, mergedCssPath) {
// Rewrite relative paths (that refers to the internal application tree)
// to absolute paths (addressable from the public build).
if (isRelative(resource.path)) {
absolutePath = pathJoin(basePath, resource.path);
absolutePath = pathJoin(basePath, resource.path + resource.hash);
} else {
absolutePath = resource.path;
}