[ 
https://issues.apache.org/jira/browse/TAP5-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17897022#comment-17897022
 ] 

Ben Weidig commented on TAP5-2791:
----------------------------------

Thank you for the detailed ticket with the code and possible solution.

Disabling white-space removal breaks multiple other unit tests, as some removal 
makes sense.
I'll add a check for {{data:image/svg+xml}} in the token and then only trim the 
content instead of removing all whitespace.

The YUICompressor is a constant source of minor issues, I really want to 
replace it with something more sensible, or even write a custom 
CSS-Parser/Optimizer for Tapestry in the future.


> 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.0, 5.8.7
>            Reporter: Hendrik Noot
>            Assignee: Ben Weidig
>            Priority: Major
>
> 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