Skip to content

Commit

Permalink
Suppression des décimales inutiles
Browse files Browse the repository at this point in the history
  • Loading branch information
NumEricR committed May 10, 2012
1 parent 01281d1 commit 74843e7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions inc/functions.php
Expand Up @@ -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);
Expand Down

0 comments on commit 74843e7

Please sign in to comment.