I have a base theme and a sub-theme. The sub-theme specifies a single styles.css in the *.info file. The base theme provides CDN css stylesheets, via this hook:
function MYTHEME_preprocess_html(&$css) {
drupal_add_css('http://yui.yahooapis.com/pure/0.5.0/pure-min.css', array(
'group' => CSS_THEME,
'preprocess' => FALSE
));
drupal_add_css('http://yui.yahooapis.com/pure/0.5.0/grids-responsive-old-ie-min.css', array(
'group' => CSS_THEME,
'browsers' => array('IE' => 'lte IE 8'),
'preprocess' => FALSE
));
drupal_add_css('http://yui.yahooapis.com/pure/0.5.0/grids-responsive-min.css', array(
'group' => CSS_THEME,
'browsers' => array('IE' => 'gt IE 8'),
'preprocess' => FALSE
));
drupal_add_css('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', array(
'group' => CSS_THEME,
'preprocess' => FALSE
));
}
The resulting HTML is this:
<style type="text/css" media="screen">@import url("http://mysite.local/sites/all/themes/mytheme/styles.css?nezret");</style>
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css?nezret" media="all">
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/grids-responsive-min.css?nezret" media="all">
I need the @import to come in dead last in rendered order -- otherwise it seems the base theme styles are overriding my theme specific styless...
I have tried to correct this in the sub--theme by doing:
function MYTHEME_css_alter(&$css) {
foreach($css as $key => $value) {
if($key == 'sites/all/themes/MYTHEME/styles.css') {
$css[$key]['weight'] = 1000;
}
}
uasort($css, 'drupal_sort_weight');
}
This fixes the array but not the rendering order...WTF am I missing or doing wrong???