mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-76907 core: Add custom Moodle patch to minify
There is a Pull-request from Tim Hunt to the project in GitHub (https://github.com/matthiasmullie/minify/issues/317) but, for now, as it hasn't been applied yet, we need to manually cherry-pick this change.
This commit is contained in:
parent
dc40a20ed7
commit
e9cb651b5d
1 changed files with 28 additions and 0 deletions
|
@ -641,7 +641,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', '');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue