mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-43105 JavaScript: Use the correct versions of our rollups
This commit is contained in:
parent
f7434db109
commit
104d698ffd
2 changed files with 20 additions and 8 deletions
|
@ -1249,14 +1249,25 @@ class page_requirements_manager {
|
||||||
$code = '';
|
$code = '';
|
||||||
|
|
||||||
$jsrev = $this->get_jsrev();
|
$jsrev = $this->get_jsrev();
|
||||||
|
|
||||||
|
$yuiformat = '-min';
|
||||||
|
if ($this->yui3loader->filter === 'RAW') {
|
||||||
|
$yuiformat = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$format = '-min';
|
||||||
|
if ($this->YUI_config->groups['moodle']['filter'] === 'DEBUG') {
|
||||||
|
$format = '-debug';
|
||||||
|
}
|
||||||
|
|
||||||
$baserollups = array(
|
$baserollups = array(
|
||||||
'rollup/' . $CFG->yui3version . '/yui-moodlesimple-min.js',
|
'rollup/' . $CFG->yui3version . '/yui-moodlesimple' . $yuiformat . '.js',
|
||||||
);
|
);
|
||||||
// The reason for separate rollups is that the Y = YUI().use('*') call is run async and
|
// The reason for separate rollups is that the Y = YUI().use('*') call is run async and
|
||||||
// it gets it's knickers in a twist. Putting it in a separate <script>
|
// it gets it's knickers in a twist. Putting it in a separate <script>
|
||||||
// to the moodle rollup means that it's completed before the moodle one starts.
|
// to the moodle rollup means that it's completed before the moodle one starts.
|
||||||
$moodlerollups = array(
|
$moodlerollups = array(
|
||||||
'rollup/' . $jsrev . '/mcore-min.js',
|
'rollup/' . $jsrev . '/mcore' . $format . '.js',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->yui3loader->combine) {
|
if ($this->yui3loader->combine) {
|
||||||
|
@ -1290,10 +1301,8 @@ class page_requirements_manager {
|
||||||
|
|
||||||
if ($this->yui3loader->filter === 'RAW') {
|
if ($this->yui3loader->filter === 'RAW') {
|
||||||
$code = str_replace('-min.css', '.css', $code);
|
$code = str_replace('-min.css', '.css', $code);
|
||||||
$code = str_replace('-min.js', '.js', $code);
|
|
||||||
} else if ($this->yui3loader->filter === 'DEBUG') {
|
} else if ($this->yui3loader->filter === 'DEBUG') {
|
||||||
$code = str_replace('-min.css', '.css', $code);
|
$code = str_replace('-min.css', '.css', $code);
|
||||||
$code = str_replace('-min.js', '-debug.js', $code);
|
|
||||||
}
|
}
|
||||||
return $code;
|
return $code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,12 +88,13 @@ while (count($parts)) {
|
||||||
|
|
||||||
if (strpos($rollupname, 'yui-moodlesimple') !== false) {
|
if (strpos($rollupname, 'yui-moodlesimple') !== false) {
|
||||||
if (substr($rollupname, -3) === '.js') {
|
if (substr($rollupname, -3) === '.js') {
|
||||||
// Determine whether we should minify this rollup.
|
// Determine which version of this rollup should be used.
|
||||||
preg_match('/(-min)?\.js/', $rollupname, $matches);
|
|
||||||
$filesuffix = '.js';
|
$filesuffix = '.js';
|
||||||
|
preg_match('/(-(debug|min))?\.js/', $rollupname, $matches);
|
||||||
if (isset($matches[1])) {
|
if (isset($matches[1])) {
|
||||||
$filesuffix = '-min.js';
|
$filesuffix = $matches[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = 'js';
|
$type = 'js';
|
||||||
} else if (substr($rollupname, -4) === '.css') {
|
} else if (substr($rollupname, -4) === '.css') {
|
||||||
$type = 'css';
|
$type = 'css';
|
||||||
|
@ -216,9 +217,11 @@ while (count($parts)) {
|
||||||
'core/notification/notification-dialogue',
|
'core/notification/notification-dialogue',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Determine which version of this rollup should be used.
|
||||||
$filesuffix = '.js';
|
$filesuffix = '.js';
|
||||||
|
preg_match('/(-(debug|min))?\.js/', $rollupname, $matches);
|
||||||
if (isset($matches[1])) {
|
if (isset($matches[1])) {
|
||||||
$filesuffix = '-min.js';
|
$filesuffix = $matches[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to add these new parts to the beginning of the $parts list, not the end.
|
// We need to add these new parts to the beginning of the $parts list, not the end.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue