Permalink
Browse files

Suppression des décimales inutiles

  • Loading branch information...
1 parent 01281d1 commit 74843e709afaa0711b54e9322f478317c1036787 @NumEricR committed May 7, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 inc/functions.php
View
@@ -162,6 +162,8 @@ private function compress_css($css_to_compress,$lvl=0){
// Ecriture trop lourde
$css_to_compress = str_replace(';;', ';', $css_to_compress);
$css_to_compress = preg_replace('#:0(px|em|ex|%|pt|pc|in|cm|mm|rem|vw|vh|vm);#', ':0;', $css_to_compress);
+ // Suppression des décimales inutiles
+ $css_to_compress = preg_replace('#:([^;]*[1-9]+[0-9]*)\.0+(px|em|ex|%|pt|pc|in|cm|mm|rem|vw|vh|vm)([^;]*);#', ':$1$2$3;', $css_to_compress);
// Simplification des codes couleurs hexadécimaux
$css_to_compress = preg_replace_callback('#(:[^;]*\#)([a-fA-F\d])\2([a-fA-F\d])\3([a-fA-F\d])\4([^;]*;)#', array($this, 'short_hex_color_values'), $css_to_compress);

0 comments on commit 74843e7

Please sign in to comment.