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

Raigo Aljand commented on TAP5-2753:
------------------------------------

Just for information, I hit the same problem when I tried out the 
CssCompressor. Then I tried simply replacing the code in Tapestry with the 
latest YUI compressor version, and that fixed it. I don't remember exactly what 
I changed, but I found, what seemed to be YUI Compressor code copied into 
Tapestry, and I replaced that with the latest from YUI compressor.

Even though the project isn't maintained, Tapestry doesn't have the latest 
version in it either, it's a double whammy.

> CssCompressor for CSS files produces wrong minification if calc contains 
> variables.
> -----------------------------------------------------------------------------------
>
>                 Key: TAP5-2753
>                 URL: https://issues.apache.org/jira/browse/TAP5-2753
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-webresources
>    Affects Versions: 5.8.2
>            Reporter: LRein
>            Assignee: Ben Weidig
>            Priority: Minor
>
> CssCompressor for CSS files produces wrong minification if calc contains 
> variables.
> {code:css}
> .some-class
> {
> padding-top: calc(10px + var(--default-page-header-height));
> }
> {code}
> produces spaces between dashes within the variable:
> {code:css}
> .some-class
> {
> padding-top: calc(10px + var( - - default - page - header - height));
> }
> {code}
> Just removing this code block at the end helps:
> {code:java}
> // Add spaces back in between operators for css calc function
> // https://developer.mozilla.org/en-US/docs/Web/CSS/calc
> // Added by Eric Arnol-Martin (earnolmar...@gmail.com)
> sb = new StringBuffer();
> p = Pattern.compile("calc\\([^\\)]*\\)");
> m = p.matcher(css);
> while (m.find()) {
>     String s = m.group();
>     
>     s = s.replaceAll("(?<=[-|%|px|em|rem|vw|\\d]+)\\+", " + ");
>     s = s.replaceAll("(?<=[-|%|px|em|rem|vw|\\d]+)\\-", " - ");
>     s = s.replaceAll("(?<=[-|%|px|em|rem|vw|\\d]+)\\*", " * ");
>     s = s.replaceAll("(?<=[-|%|px|em|rem|vw|\\d]+)\\/", " / ");
>     
>     m.appendReplacement(sb, s);
> }
> m.appendTail(sb);
> css = sb.toString(); 
> {code}



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

Reply via email to