Hendrik Noot created TAP5-2791:
----------------------------------

             Summary: CssCompressor for CSS files produces wrong minification 
for url() function, at least with data URLs
                 Key: TAP5-2791
                 URL: https://issues.apache.org/jira/browse/TAP5-2791
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-webresources
    Affects Versions: 5.8.7, 5.8.0
            Reporter: Hendrik Noot


This problem is closely related to TAP5-2753 and caused by the optimisation 
(yuicompressor update) from TAP5-2708.

The CssCompressor removes white spaces from url() functions inside CSS files. 
So for example if you use a SVG as an backround image something like 
'urlheight="1em" viewBox="0 0 576 512"' becomes 
'height="1em"viewBox="00576512"' which breaks the SVG.

There is also an open issue for yuicompressor: 
[https://github.com/yui/yuicompressor/issues/344]

The fix inside the CssCompressor is to disable white space removal for the url 
function, change:
{code:java}
css = preserveToken(css, "url", PRESERVE_TOKEN_URL, true, "TOKEN", 
preservedTokens); {code}
to:
{code:java}
css = preserveToken(css, "url", PRESERVE_TOKEN_URL, false, "TOKEN", 
preservedTokens);
{code}
This works for me and I couldn't find any negative side effects.

If needed I can provide a pull request.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to