Currently, my D7 Marinelli site loads with 7 CSS files and 4 JS files when aggregation is enabled, compared to only 1 CSS and JS file on my D6 site. This is no doubt hurting load times by forcing the browser to make so many requests with every page load. It's hard to tell what's due to core and what's due to Marinelli, but I know for sure that Marinelli is partly responsible.
For instance, in template.php, simply changing the drupal_add_css options parameters from array('group' => CSS_THEME + 1,'every_page' =>TRUE))
, array('group' => CSS_THEME + 2,'every_page' =>TRUE))
to array('group' => CSS_THEME,'every_page' =>TRUE))
cuts down the number of aggregated files by 1. Is there a reason these really need to be weighted in that order? Are there other places where drupal_add_css can be modified to cut down on the number of aggregated CSS files?
Comment | File | Size | Author |
---|---|---|---|
#3 | marinelli-1075018-3.patch | 1.08 KB | Dane Powell |
Comments
Comment #1
Lioz CreditAttribution: Lioz commentedHi dane, this seems a normal behaviour for drupal7 see this link
The documentation of drupal_add_css doesn't seem very clear to me though.
http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ad...
according to that
but if I see the source i notice that css3.css and css3_graphics.css are compressed into two different files even if they are both set to 'every_page' in the theme group.
Am I missing something in the documentation?
Comment #2
Dane Powell CreditAttribution: Dane Powell commentedcss3.css and css3_graphics.css are put into two different aggregate files because they are in separate 'groups' (from template.php):
The question here is do they need to be in separate groups? That is, do they need to be included in a certain order? If not, then we should put them all in CSS_THEME, not CSS_THEME + 1, CSS_THEME + 2, etc...
Comment #3
Dane Powell CreditAttribution: Dane Powell commentedSimple patch- works great for me