mirror of
https://github.com/matthiasmullie/minify.git
synced 2025-02-25 05:02:32 +01:00
Get rid of another regular expression
This commit is contained in:
parent
c1606f07e9
commit
85db14d29d
11
src/JS.php
11
src/JS.php
@ -274,13 +274,12 @@ class JS extends Minify
|
||||
// uniform line endings, make them all line feed
|
||||
$content = str_replace(array("\r\n", "\r"), "\n", $content);
|
||||
|
||||
// strip leading & trailing whitespace
|
||||
$content = preg_replace('/^\s+/m', '', $content);
|
||||
$content = preg_replace('/\s+$/m', '', $content);
|
||||
|
||||
// collapse all non-line feed whitespace into single space
|
||||
// collapse all non-line feed whitespace into a single space
|
||||
$content = preg_replace('/[^\S\n]+/', ' ', $content);
|
||||
|
||||
// strip leading & trailing whitespace
|
||||
$content = str_replace(array(" \n", "\n "), "\n", $content);
|
||||
|
||||
// collapse consecutive line feeds into just 1
|
||||
$content = preg_replace('/\n+/', "\n", $content);
|
||||
|
||||
@ -326,7 +325,7 @@ class JS extends Minify
|
||||
*/
|
||||
$content = preg_replace('/;\}/s', '}', $content);
|
||||
|
||||
return $content;
|
||||
return trim($content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user