Here's the modified function.
/**
* Add a CSS file for output later
*
* @param mixed $filenames string or array of filenames to work on
* @param mixed[] $params = array()
* Keys are the following:
* - ['local'] (true/false): define if the file is local
* - ['fallback'] (true/false): if false will attempt to load the file
* from the default theme if not found in the current theme
* - ['variant'] (true/false): if true will attempt to load the file
* from the theme variant falling back to the default theme if not available
* - ['stale'] (true/false/string): if true or null, use cache stale,
* false do not, or used a supplied string
* @param string $id optional id to use in html id=""
*/
function loadCSSFile($filenames, $params = array(), $id = '')
{
global $settings, $context, $db_show_debug;
if (empty($filenames))
return;
if (!is_array($filenames))
$filenames = array($filenames);
// Static values for all these settings
$params['stale'] = (!isset($params['stale']) || $params['stale'] === true) ? CACHE_STALE : (is_string($params['stale']) ? ($params['stale'] = $params['stale'][0] === '?' ? $params['stale'] : '?' . $params['stale']) : '');
$params['fallback'] = (isset($params['fallback']) && ($params['fallback'] === false)) ? false : true;
if ((isset($params['variant']) && ($params['variant'] === false)) || empty($context['theme_variant']))
{
$params['variant'] = false;
$params['cache_dir'] = $settings['theme_dir'];
$params['dir'] = $settings['theme_dir'] . '/css/';
$params['url'] = $settings['theme_url'] . '/css/';
}
else
{
$params['variant'] = true;
$params['cache_dir'] = $settings['theme_dir'] . $context['theme_variant'];
$params['dir'] = $settings['theme_dir'] . '/css/' . $context['theme_variant'] . '/';
$params['url'] = $settings['theme_url'] . '/css/' . $context['theme_variant_url'];
}
// Whoa ... we've done this before yes?
$cache_name = 'load_css_' . md5($params['cache_dir'] . implode('_', $filenames));
if (($temp = cache_get_data($cache_name, 600)) !== null)
{
if (empty($context['css_files']))
$context['css_files'] = array();
$context['css_files'] += $temp;
}
else
{
$this_build = array();
// All the files in this group use the parameters as defined above
foreach ($filenames as $filename)
{
// Account for shorthand like admin.css?xyz11 filenames
$has_cache_staler = strpos($filename, '.css?');
$params['basename'] = $has_cache_staler ? substr($filename, 0, $has_cache_staler + 4) : $filename;
$this_id = empty($id) ? strtr(basename($filename), '?', '_') : $id;
// Is this a local file?
if (substr($filename, 0, 4) !== 'http' || !empty($params['local']))
{
$params['local'] = true;
// Fallback if needed?
if ($params['fallback'] && ($params['variant'] || ($settings['theme_dir'] !== $settings['default_theme_dir'])) && !file_exists($params['dir'] . $filename))
{
// Fallback if we are not already in the default theme
if (file_exists($settings['default_theme_dir'] . '/css/' . $filename))
{
$filename = $settings['default_theme_url'] . '/css/' . $filename . ($has_cache_staler ? '' : $params['stale']);
}
else
$filename = false;
}
else
$filename = $params['url'] . $filename . ($has_cache_staler ? '' : $params['stale']);
}
// Add it to the array for use in the template
if (!empty($filename))
$this_build[$this_id] = $context['css_files'][$this_id] = array('filename' => $filename, 'options' => $params);
if ($db_show_debug === true)
$context['debug']['sheets'][] = $params['basename'] . (!empty($params['url']) ? '(' . basename($params['url']) . ')' : '');
// Save this build
cache_put_data($cache_name, $this_build, 600);
}
}
}
And yes this would require a few changes elsewhere in Load.php to drop the _variant part of the file names.