Adds 0deg -> 0 minification.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 4 Jan 2015 11:42:59 +0000 (11:42 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 4 Jan 2015 20:20:47 +0000 (20:20 +0000)
* That's when value is the only argument, e.g. `skew` or `rotate`.

History.md
lib/selectors/optimizers/simple.js
test/fixtures/big-min.css
test/fixtures/font-awesome-min.css
test/selectors/optimizers/simple-test.js

index fa3dde6..6e4c5b2 100644 (file)
@@ -1,3 +1,8 @@
+[3.1.0 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.2...v3.1.0)
+==================
+
+* Adds 0deg to 0 minification where possible.
+
 [3.0.2 / 2015-01-04](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.1...v3.0.2)
 ==================
 
index f5ce69a..676f39a 100644 (file)
@@ -89,6 +89,13 @@ function zeroMinifier(_, value) {
     .replace(/(^|\D)0\.(\d)/g, '$1.$2');
 }
 
+function zeroDegMinifier(_, value) {
+  if (value.indexOf('0deg') == -1)
+    return value;
+
+  return value.replace(/\(0deg\)/g, '(0)');
+}
+
 function precisionMinifier(_, value, precisionOptions) {
   if (precisionOptions.value === -1 || value.indexOf('.') === -1)
     return value;
@@ -192,6 +199,7 @@ function reduce(body, options) {
 
     value = precisionMinifier(property, value, options.precision);
     value = zeroMinifier(property, value);
+    value = zeroDegMinifier(property, value);
     value = unitMinifier(property, value, options.unitsRegexp);
     value = multipleZerosMinifier(property, value);
     value = colorMininifier(property, value, options.compatibility);
index 3f9a3c4..3c8afbc 100644 (file)
@@ -552,7 +552,7 @@ img[height="97"]+.ico29x29{bottom:6%;left:3.5%}
 .edito_ensemble_liste p{min-height:45px}
 .edito_ensemble_lien{cursor:pointer}
 .edito_ensemble_lien .double_chevron{display:inline-block;width:9px;height:9px;margin-left:10px;background:url(/medias/web/img/pictos/chevrons_double_haut_bas.png) no-repeat}
-.edito_ensemble_lien.resize_mini .double_chevron{transform:rotate(0deg);-ms-transform:rotate(0deg);-moz-transform:rotate(0deg);-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);-webkit-transition-property:transform;-webkit-transition-duration:.5s;-webkit-transition-timing-function:ease-in;-moz-transition-property:transform;-moz-transition-duration:.5s;-moz-transition-timing-function:ease-in;transition-property:transform;transition-duration:.5s;transition-timing-function:ease-in}
+.edito_ensemble_lien.resize_mini .double_chevron{transform:rotate(0);-ms-transform:rotate(0);-moz-transform:rotate(0);-webkit-transform:rotate(0);-o-transform:rotate(0);-webkit-transition-property:transform;-webkit-transition-duration:.5s;-webkit-transition-timing-function:ease-in;-moz-transition-property:transform;-moz-transition-duration:.5s;-moz-transition-timing-function:ease-in;transition-property:transform;transition-duration:.5s;transition-timing-function:ease-in}
 .edito_ensemble_lien.resize_maxi .double_chevron{transform:rotate(180deg);-ms-transform:rotate(180deg);-moz-transform:rotate(180deg);-webkit-transform:rotate(180deg);-o-transform:rotate(180deg);-webkit-transition-property:transform;-webkit-transition-duration:.5s;-webkit-transition-timing-function:ease-in;-moz-transition-property:transform;-moz-transition-duration:.5s;-moz-transition-timing-function:ease-in;transition-property:transform;transition-duration:.5s;transition-timing-function:ease-in}
 .conteneur_onglets{height:35px;border:solid #d2d6db;border-width:0 0 1px}
 .conteneur_onglets .onglet{float:left;background:#fff;text-align:center}
@@ -2976,4 +2976,4 @@ html.js body.dummy div#mainContent div#core-liberation div.col9 div.block div.bl
 html.js body.dummy div#mainContent div#core-liberation div.col9 div.block div.block-content div.favorites-frontpages div.col-left div.cartridge{width:388px}
 html.js body.dummy div#mainContent div#core-liberation div.col9 div.block div.block-content div.favorites-folders div.block-call-items div.block-content div.mini-tpl div.cartridge{margin-left:0;width:129px}
 html.js body.dummy div#mainContent div#core-liberation div.col7 div.block-call-items div.block-content div.mini-tpl div.folder-on-demand div.object-content{margin-right:0;min-height:0;border-bottom:0}
-html.js body.dummy div#mainContent div#core-liberation div.col7 div.block-call-items div.block-content div.mini-tpl div.folder-on-demand{border-bottom:1px solid #E7E7E7}
\ No newline at end of file
+html.js body.dummy div#mainContent div#core-liberation div.col7 div.block-call-items div.block-content div.mini-tpl div.folder-on-demand{border-bottom:1px solid #E7E7E7}
index afe73ac..3666ecc 100644 (file)
@@ -54,15 +54,15 @@ ul.icons li [class*=" icon-"],ul.icons li [class^=icon-]{width:.75em}
 .btn.btn-large [class*=" icon-"].pull-left.icon-2x,.btn.btn-large [class^=icon-].pull-left.icon-2x{margin-right:.2em}
 .btn.btn-large [class*=" icon-"].pull-right.icon-2x,.btn.btn-large [class^=icon-].pull-right.icon-2x{margin-left:.2em}
 .icon-spin{display:inline-block;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}
-@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}
+@-moz-keyframes spin{0%{-moz-transform:rotate(0)}
 100%{-moz-transform:rotate(359deg)}}
-@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}
+@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}
 100%{-webkit-transform:rotate(359deg)}}
-@-o-keyframes spin{0%{-o-transform:rotate(0deg)}
+@-o-keyframes spin{0%{-o-transform:rotate(0)}
 100%{-o-transform:rotate(359deg)}}
-@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}
+@-ms-keyframes spin{0%{-ms-transform:rotate(0)}
 100%{-ms-transform:rotate(359deg)}}
-@keyframes spin{0%{transform:rotate(0deg)}
+@keyframes spin{0%{transform:rotate(0)}
 100%{transform:rotate(359deg)}}
 @-moz-document url-prefix(){.icon-spin{height:.9em}
 .btn .icon-spin{height:auto}
@@ -316,4 +316,4 @@ ul.icons li [class*=" icon-"],ul.icons li [class^=icon-]{width:.75em}
 .icon-reply:before{content:"\f112"}
 .icon-github-alt:before{content:"\f113"}
 .icon-folder-close-alt:before{content:"\f114"}
-.icon-folder-open-alt:before{content:"\f115"}
\ No newline at end of file
+.icon-folder-open-alt:before{content:"\f115"}
index 9ddae42..e9b59f8 100644 (file)
@@ -357,6 +357,18 @@ vows.describe(SimpleOptimizer)
         'a{width:0px}',
         ['width:0']
       ],
+      'degrees': [
+        'div{background:linear-gradient(0deg,red,#fff)}',
+        ['background:linear-gradient(0deg,red,#fff)']
+      ],
+      'degrees when not mixed': [
+        'div{transform:rotate(0deg) skew(0deg)}',
+        ['transform:rotate(0) skew(0)']
+      ],
+      'non-zero degrees when not mixed': [
+        'div{transform:rotate(10deg) skew(.5deg)}',
+        ['transform:rotate(10deg) skew(.5deg)']
+      ],
       'mixed units': [
         'a{margin:0em 0rem 0px 0pt}',
         ['margin:0']