Skip to content

Commit

Permalink
Merge branch 'MDL-43105-master' of git://github.com/andrewnicols/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Dec 3, 2013
2 parents 3e1a057 + 104d698 commit 75b296a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
17 changes: 13 additions & 4 deletions lib/outputrequirementslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1249,14 +1249,25 @@ protected function get_yui3lib_headcode($page) {
$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) {
Expand Down Expand Up @@ -1290,10 +1301,8 @@ protected function get_yui3lib_headcode($page) {

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;
}
Expand Down
11 changes: 7 additions & 4 deletions theme/yui_combo.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@

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';
Expand Down Expand Up @@ -216,9 +217,11 @@
'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.
Expand Down

0 comments on commit 75b296a

Please sign in to comment.