Skip to content

Commit

Permalink
Fix #84: CSS cal with vh incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Aug 4, 2022
1 parent 57e47d4 commit a5de5c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,10 @@ public void compress(Writer out, int linebreakpos) throws IOException {
while (m.find()) {
String s = m.group();
s = s.replaceAll("\\s+", "");
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])\\/", " / ");
s = s.replaceAll("(?<=[-|%|)|px|em|rem|vh|vw|\\d])\\+", " + ");
s = s.replaceAll("(?<=[-|%|)|px|em|rem|vh|vw|\\d])\\-", " - ");
s = s.replaceAll("(?<=[-|%|)|px|em|rem|vh|vw|\\d])\\*", " * ");
s = s.replaceAll("(?<=[-|%|)|px|em|rem|vh|vw|\\d])\\/", " / ");

m.appendReplacement(sb, s);
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/calc.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
left:calc(50%-(100px * 2));
width: calc( 25% +10px);
right: calc(((100% - 1200px) /2) + 16px);
height:calc(50% + 4px)
height:calc(50% + 4px);
bottom:calc(100vh - 20px);
}
2 changes: 1 addition & 1 deletion src/test/resources/calc.css.min
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.test-calc{top:calc(-100vw + 4em) !important;left:calc(50% - (100px * 2));width:calc(25% + 10px);right:calc(((100% - 1200px) / 2) + 16px);height:calc(50% + 4px)}
.test-calc{top:calc(-100vw + 4em) !important;left:calc(50% - (100px * 2));width:calc(25% + 10px);right:calc(((100% - 1200px) / 2) + 16px);height:calc(50% + 4px);bottom:calc(100vh - 20px)}

0 comments on commit a5de5c4

Please sign in to comment.