Changeset 471 for trunk/lib/JS.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/JS.inc.php

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