For the following font file include in a CSS file, the path replacement (to fix the relative path to the included file) doesn't work correctly:
src: url("../fonts/fostbook-webfont.svg#Foundry Sterling Book") format("svg");
where this works correctly
src: url("../fonts/fostbook-webfont.svg#FoundrySterlingBook") format("svg");
The resulting code in the aggregated file is:
src: url("../fonts/fostbook-webfont.svg#Foundry Sterling Book") format("svg");
and
src: url("//website.local/sites/all/themes/custom/themename/css/font-awesome/fonts/fostbook-webfont.svg#foundrysterlingbook") format("svg");
Comments
Comment #2
moonray commentedThe offending code is the following:
$contents = preg_replace_callback('%url\(\s*+[\'"]?+(?![a-z]++:|/|\#|\%23+)([^\'"()\s]++)[\'"]?+\s*+\)%i', '_advagg_build_css_path', $contents);I'm hesitant to simply strip the "Don't include space" part of the regex pattern that would make this work. Is there a particular reason to not allow spaces in the url pattern?
Comment #3
mikeytown2 commentedMost likely related to these 4 issues:
#1961340: CSS aggregation breaks file URL rewriting because it abuses it
#2362643: Drupal alters svg fill paths with base url -> broken svg
#258846: CSS aggregation fails to parse some url()'s
#352042: drupal_build_css_cache() cannot deal with a url() statement not surrounded by spaces.
I believe advagg has the correct tests for these so go ahead and create a patch and see if it passes the tests.
Comment #4
moonray commentedAfter reading through the CSS specs it seems that the following patch should work to fix the issue.
Comment #7
mikeytown2 commentedSame patch but with the file path fixed
Comment #8
mikeytown2 commentedAdded some tests to this
Comment #11
mikeytown2 commentedLooks like the quotes are kept due to the spaces being inside them.
Comment #14
mikeytown2 commentedComment #15
mikeytown2 commented#14 has been committed.
Comment #17
moonray commentedThat was quick! Thanks.