Merge branch 'MDL-68191' of git://github.com/timhunt/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2020-04-01 20:18:25 +02:00
2 changed files with 35 additions and 0 deletions
@@ -636,7 +636,35 @@ class CSS extends Minify
return $placeholder;
};
// Moodle-specific change MDL-68191 starts.
/* This was the old code:
$this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve).*?\*\/\n?/s', $callback);
*/
// This is the new, more accurate and faster regex.
$this->registerPattern('/
# optional newline
\n?
# start comment
\/\*
# comment content
(?:
# either starts with an !
!
|
# or, after some number of characters which do not end the comment
(?:(?!\*\/).)*?
# there is either a @license or @preserve tag
@(?:license|preserve)
)
# then match to the end of the comment
.*?\*\/\n?
/ixs', $callback);
// Moodle-specific change MDL-68191.
$this->registerPattern('/\/\*.*?\*\//s', '');
}
+7
View File
@@ -14,3 +14,10 @@ Local changes applied:
MDL-67115: php 74 compliance - implode() params order. Note this has been fixed upstream
by https://github.com/matthiasmullie/minify/pull/300 so, whenever this library is updated
check if the fix is included and remove this note.
MDL-68191: https://github.com/matthiasmullie/minify/issues/317 is a bug that stops
large sections of the CSS from being minimised, and also is a huge performance drain.
We have applied the fix sent upstream because the performance win is so big.
(E.g. one case I measured, with the bug was 40 seconds to minify CSS, with the fix was
a few seconds. This is one of the reasons Behat runs in the browser are so slow.)
Whenever this library is updated check if the fix is included and remove this note.