Skip to content

Commit

Permalink
Allow CSSmin instance to be re-used for multiple run() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mrclay committed Mar 16, 2012
1 parent 9dba65a commit 6eefd7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions min/lib/CSSMin.php
Expand Up @@ -37,6 +37,9 @@ public function run($css, $linebreak_pos = FALSE)
ini_set('pcre.backtrack_limit', 1000 * 1000);
ini_set('pcre.recursion_limit', 500 * 1000);

$this->comments = array();
$this->preserved_tokens = array();

$start_index = 0;
$length = strlen($css);

Expand Down
4 changes: 2 additions & 2 deletions min_unit_tests/test_CSSmin.php
Expand Up @@ -15,14 +15,14 @@ function test_CSSmin()
//'dataurl-base64-singlequotes.css',
);

$cssmin = new CSSmin();

foreach ($files as $file) {
if (! empty($skip) && in_array(basename($file), $skip)) {
echo "INFO: CSSmin: skipping " . basename($file) . "\n";
continue;
}

$cssmin = new CSSmin();

$src = file_get_contents($file);
$minExpected = trim(file_get_contents($file . '.min'));
$minOutput = trim($cssmin->run($src));
Expand Down

0 comments on commit 6eefd7a

Please sign in to comment.