modif comtabilite
This commit is contained in:
+1
-1
@@ -86,7 +86,7 @@ class CSS extends Minify
|
||||
*/
|
||||
protected function moveImportsToTop($content)
|
||||
{
|
||||
if (preg_match_all('/(;?)(@import (?<url>url\()?(?P<quotes>["\']?).+?(?P=quotes)(?(url)\)))/', $content, $matches)) {
|
||||
if (preg_match_all('/(;?)(@import (?<url>url\()?(?P<quotes>["\']?).+?(?P=quotes)(?(url)\)));?/', $content, $matches)) {
|
||||
// remove from content
|
||||
foreach ($matches[0] as $import) {
|
||||
$content = str_replace($import, '', $content);
|
||||
|
||||
+2
-2
@@ -238,7 +238,7 @@ class JS extends Minify
|
||||
// closing the regex)
|
||||
// then also ignore bare `/` inside `[]`, where they don't need to be
|
||||
// escaped: anything inside `[]` can be ignored safely
|
||||
$pattern = '\\/(?:[^\\[\\/\\\\\n\r]+|(?:\\\\.)+|(?:\\[(?:[^\\]\\\\\n\r]+|(?:\\\\.)+)+\\])+)++\\/[gimy]*';
|
||||
$pattern = '\\/(?:[^\\[\\/\\\\\n\r]+|(?:\\\\.)+|(?:\\[(?:[^\\]\\\\\n\r]+|(?:\\\\.)+)+\\])+)++\\/[gimuy]*';
|
||||
|
||||
// a regular expression can only be followed by a few operators or some
|
||||
// of the RegExp methods (a `\` followed by a variable or value is
|
||||
@@ -264,7 +264,7 @@ class JS extends Minify
|
||||
);
|
||||
$delimiters = array_fill(0, count($propertiesAndMethods), '/');
|
||||
$propertiesAndMethods = array_map('preg_quote', $propertiesAndMethods, $delimiters);
|
||||
$after = '(?=\s*[\.,;\)\}&\|+]|\/\/|$|\.('.implode('|', $propertiesAndMethods).'))';
|
||||
$after = '(?=\s*([\.,;\)\}&\|+]|\/\/|$|\.('.implode('|', $propertiesAndMethods).')))';
|
||||
$this->registerPattern('/'.$before.'\K'.$pattern.$after.'/', $callback);
|
||||
|
||||
// regular expressions following a `)` are rather annoying to detect...
|
||||
|
||||
+7
-2
@@ -239,6 +239,12 @@ abstract class Minify
|
||||
foreach ($this->patterns as $i => $pattern) {
|
||||
list($pattern, $replacement) = $pattern;
|
||||
|
||||
// we can safely ignore patterns for positions we've unset earlier,
|
||||
// because we know these won't show up anymore
|
||||
if (!isset($positions[$i])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// no need to re-run matches that are still in the part of the
|
||||
// content that hasn't been processed
|
||||
if ($positions[$i] >= 0) {
|
||||
@@ -257,8 +263,7 @@ abstract class Minify
|
||||
// if the pattern couldn't be matched, there's no point in
|
||||
// executing it again in later runs on this same content;
|
||||
// ignore this one until we reach end of content
|
||||
unset($matches[$i]);
|
||||
$positions[$i] = strlen($content);
|
||||
unset($matches[$i], $positions[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user