From f0e79573cf2dd155b219604af0d2e6f9d9e4f2a8 Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Sun, 24 Mar 2013 01:19:41 +0000 Subject: [PATCH] MDL-38667 JavaScript: Correct loading of Shifted CSS --- theme/yui_combo.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/theme/yui_combo.php b/theme/yui_combo.php index 36f2694186b..957d37f356c 100644 --- a/theme/yui_combo.php +++ b/theme/yui_combo.php @@ -103,18 +103,23 @@ foreach ($parts as $part) { $filename = array_pop($bits); $modulename = $bits[0]; $dir = get_component_directory($frankenstyle); - if ($mimetype == 'text/css') { - $bits[] = 'assets'; - $bits[] = 'skins'; - $bits[] = 'sam'; - } // For shifted YUI modules, we need the YUI module name in frankenstyle format. $frankenstylemodulename = join('-', array($version, $frankenstyle, $modulename)); + $frankenstylefilename = preg_replace('/' . $modulename . '/', $frankenstylemodulename, $filename); // By default, try and use the /yui/build directory. - $frankenstylefilename = preg_replace('/' . $modulename . '/', $frankenstylemodulename, $filename); - $contentfile = $dir . '/yui/build/' . $frankenstylemodulename . '/' . $frankenstylefilename; + if ($mimetype == 'text/css') { + // CSS assets are in a slightly different place to the JS. + $contentfile = $dir . '/yui/build/' . $frankenstylemodulename . '/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; + } // If the shifted versions don't exist, fall back to the non-shifted file. if (!file_exists($contentfile) or !is_file($contentfile)) {