MDL-43105 JavaScript: Use the correct versions of our rollups

This commit is contained in:
Andrew Nicols 2013-11-28 11:49:12 +08:00
parent f7434db109
commit 104d698ffd
2 changed files with 20 additions and 8 deletions

View file

@ -1249,14 +1249,25 @@ class page_requirements_manager {
$code = '';
$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(
'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
// 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.
$moodlerollups = array(
'rollup/' . $jsrev . '/mcore-min.js',
'rollup/' . $jsrev . '/mcore' . $format . '.js',
);
if ($this->yui3loader->combine) {
@ -1290,10 +1301,8 @@ class page_requirements_manager {
if ($this->yui3loader->filter === 'RAW') {
$code = str_replace('-min.css', '.css', $code);
$code = str_replace('-min.js', '.js', $code);
} else if ($this->yui3loader->filter === 'DEBUG') {
$code = str_replace('-min.css', '.css', $code);
$code = str_replace('-min.js', '-debug.js', $code);
}
return $code;
}

View file

@ -88,12 +88,13 @@ while (count($parts)) {
if (strpos($rollupname, 'yui-moodlesimple') !== false) {
if (substr($rollupname, -3) === '.js') {
// Determine whether we should minify this rollup.
preg_match('/(-min)?\.js/', $rollupname, $matches);
// Determine which version of this rollup should be used.
$filesuffix = '.js';
preg_match('/(-(debug|min))?\.js/', $rollupname, $matches);
if (isset($matches[1])) {
$filesuffix = '-min.js';
$filesuffix = $matches[0];
}
$type = 'js';
} else if (substr($rollupname, -4) === '.css') {
$type = 'css';
@ -216,9 +217,11 @@ while (count($parts)) {
'core/notification/notification-dialogue',
);
// Determine which version of this rollup should be used.
$filesuffix = '.js';
preg_match('/(-(debug|min))?\.js/', $rollupname, $matches);
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.