Problem

CssOptimizer::processFile() adjusts any url('path/to/a.jpg') code snippets in processed files - by adding the path to the css file; this enables moving/agreggating the CSS file. The regex already excludes external and absolutely urls since appending the css file location to those urls would break them.
However in the case of clip-path (and related vendor specific css names), the url format may be url('#clip-path') and if changed will break the SVG Clipping functionality.

Solution

Adjust the regex to exclude urls that start with # or %23 (encoded #)

Backwards Compatibility

Full.

Comments

NickWilde created an issue. See original summary.

nickdickinsonwilde’s picture

Assigned: nickdickinsonwilde » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.04 KB
new3.93 KB

Test and patch.

Status: Needs review » Needs work

The last submitted patch, 2: 2994490-cssoptimizer-svg-clip-path-2.patch, failed testing. View results

nickdickinsonwilde’s picture

Status: Needs work » Needs review
StatusFileSize
new4.42 KB

Ah a second spot to change for @import included css.

Status: Needs review » Needs work

The last submitted patch, 5: 2994490-cssoptimizer-svg-clip-path-5.patch, failed testing. View results

nickdickinsonwilde’s picture

Status: Needs work » Needs review
StatusFileSize
new6.85 KB

Fix one more test(!)

idebr’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2362643: Drupal alters svg fill paths with base url -> broken svg

@NickWilde This issue was reported earlier at #2362643: Drupal alters svg fill paths with base url -> broken svg. Both patches contain an identical solution, but the related issue has more tests (and needs work for even more tests).

I suggest we close this issue as a duplicate, so we can focus our efforts in the related issue.

nickdickinsonwilde’s picture

yeah, definitely close this as duplicate. Apparently my issue queue searching failed