Changeset 471 for trunk/lib/CSS.inc.php


Ignore:
Timestamp:
Mar 20, 2014 1:47:43 AM (10 years ago)
Author:
anonymous
Message:

improved css/js strip whitespace methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/CSS.inc.php

    r468 r471  
    169169            if ($this->getParam('strip_whitespace')) {
    170170                // Strip whitespace and print file.
    171                 echo preg_replace('/[ \t\n\r]+/', ' ', file_get_contents($file, true));
     171                echo preg_replace(
     172                    array('!/\*.*?\*/!s', '/[\n\r]+/', '/([;:])\s+/m', '/\s*}[ \t]*/', '/\s*{\s*/', '/[ \t\n\r]*,[ \t\n\r]*/', '/^\s+/'),
     173                    array('', "\n", '$1', '}', '{', ',', ''), file_get_contents($file, true)
     174                );
    172175            } else {
    173176                // Include file as is.
Note: See TracChangeset for help on using the changeset viewer.