tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkemn...@apache.org
Subject [2/2] tapestry-5 git commit: TAP5-2524: don't replace 0% with 0 during CSS minification because that breaks keyframes
Date Tue, 15 Mar 2016 07:53:52 GMT
TAP5-2524: don't replace 0% with 0 during CSS minification because that breaks keyframes


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/6b912e26
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/6b912e26
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/6b912e26

Branch: refs/heads/master
Commit: 6b912e26896cd476e90b63b71da491ba6539d1f8
Parents: 0acf94a
Author: Jochen Kemnade <jochen.kemnade@eddyson.de>
Authored: Tue Jan 5 15:33:06 2016 +0100
Committer: Jochen Kemnade <jochen.kemnade@eddyson.de>
Committed: Tue Mar 15 08:53:45 2016 +0100

----------------------------------------------------------------------
 .../platform/yui/compressor/CssCompressor.java  |  2 +-
 .../webresources/tests/CssCompressorSpec.groovy | 29 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6b912e26/tapestry-webresources/src/main/java/com/yahoo/platform/yui/compressor/CssCompressor.java
----------------------------------------------------------------------
diff --git a/tapestry-webresources/src/main/java/com/yahoo/platform/yui/compressor/CssCompressor.java
b/tapestry-webresources/src/main/java/com/yahoo/platform/yui/compressor/CssCompressor.java
index c5e2ec0..be124fc 100644
--- a/tapestry-webresources/src/main/java/com/yahoo/platform/yui/compressor/CssCompressor.java
+++ b/tapestry-webresources/src/main/java/com/yahoo/platform/yui/compressor/CssCompressor.java
@@ -325,7 +325,7 @@ public class CssCompressor {
         css = css.replaceAll(";+}", "}");
 
         // Replace 0(px,em,%) with 0.
-        css = css.replaceAll("(?i)(^|[^0-9])(?:0?\\.)?0(?:px|em|%|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz)",
"$10");
+        css = css.replaceAll("(?i)(^|[^0-9])(?:0?\\.)?0(?:px|em|in|cm|mm|pc|pt|ex|deg|g?rad|m?s|k?hz)",
"$10");
 
         // Replace 0 0 0 0; with 0.
         css = css.replaceAll(":0 0 0 0(;|})", ":0$1");

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6b912e26/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy
----------------------------------------------------------------------
diff --git a/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy
b/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy
new file mode 100644
index 0000000..55ce38d
--- /dev/null
+++ b/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy
@@ -0,0 +1,29 @@
+package t5.webresources.tests
+
+import geb.spock.GebReportingSpec
+import org.apache.tapestry5.test.Jetty7Runner
+
+import com.yahoo.platform.yui.compressor.CssCompressor;
+
+import spock.lang.Issue;
+import spock.lang.Shared
+import spock.lang.Specification;
+
+class CssCompressorSpec extends Specification {
+
+    @Issue('TAP5-2524')
+    def "minify CSS with keyframes "() {
+        setup:
+        def css = '''@keyframes anim {
+    0% { opacity: 0; }
+  100% { opacity: 1; }
+}'''
+        StringWriter writer = new StringWriter()
+
+        when:
+        new CssCompressor(new StringReader(css)).compress(writer, -1)
+
+        then:
+        writer.toString() == '''@keyframes anim{0%{opacity:0}100%{opacity:1}}'''
+    }
+}


Mime
View raw message