Skip to content

Commit

Permalink
Merge branch 'MDL-40478-m' of git://github.com/andrewnicols/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Jul 17, 2013
2 parents 379cd2d + f320e8d commit 576151c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
33 changes: 19 additions & 14 deletions lib/yui/config/moodle.js
Expand Up @@ -14,24 +14,29 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

// A module name should be composed of:
// moodle-<component>-<module>[-skin]
var path = me.path,
parts = me.name.replace(/^moodle-/,'').split('-', 3),
modulename = parts.pop();
// moodle-<component>-<module>[-<submodule>][-skin]
var parts = me.name.replace(/^moodle-/,'').split('-'),
component = parts.shift(),
module = parts[0],
min = '-min';

if (/(skin|core)/.test(modulename)) {
if (/-(skin|core)$/.test(me.name)) {
// For these types, we need to remove the final word and set the type.
modulename = parts.pop();
parts.pop();
me.type = 'css';

// CSS is not minified - clear the min option.
min = '';
}

// Build the first part of the filename.
me.path = parts.join('-') + '/' + modulename + '/' + modulename;
if (module) {
// Determine the filename based on the remaining parts.
var filename = parts.join('-');

// CSS is not minified, but all other types are.
if (me.type !== 'css') {
me.path = me.path + '-min';
// Build the first part of the filename.
me.path = component + '/' + module + '/' + filename + min + '.' + me.type;
} else {
// This is a hangup from the old ways of writing Modules.
// We will start to warn about this once we have removed all core components of this form.
me.path = component + '/' + component + '.' + me.type;
}

// Add the file extension.
me.path = me.path + '.' + me.type;
9 changes: 7 additions & 2 deletions theme/yui_combo.php
Expand Up @@ -101,17 +101,22 @@
$frankenstylemodulename = join('-', array($version, $frankenstyle, $modulename));
$frankenstylefilename = preg_replace('/' . $modulename . '/', $frankenstylemodulename, $filename);

// Submodules are stored in a directory with the full submodule name.
// We need to remove the -debug.js, -min.js, and .js from the file name to calculate that directory name.
$frankenstyledirectoryname = str_replace(array('-min.js', '-debug.js', '.js'), '', $frankenstylefilename);

// By default, try and use the /yui/build directory.
$contentfile = $dir . '/yui/build/' . $frankenstyledirectoryname;
if ($mimetype == 'text/css') {
// CSS assets are in a slightly different place to the JS.
$contentfile = $dir . '/yui/build/' . $frankenstylemodulename . '/assets/skins/sam/' . $frankenstylefilename;
$contentfile = $contentfile . '/assets/skins/sam/' . $frankenstylefilename;

// Add the path to the bits to handle fallback for non-shifted assets.
$bits[] = 'assets';
$bits[] = 'skins';
$bits[] = 'sam';
} else {
$contentfile = $dir . '/yui/build/' . $frankenstylemodulename . '/' . $frankenstylefilename;
$contentfile = $contentfile . '/' . $frankenstylefilename;
}

// If the shifted versions don't exist, fall back to the non-shifted file.
Expand Down

0 comments on commit 576151c

Please sign in to comment.