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?

CommentFileSizeAuthor
#3 marinelli-1075018-3.patch1.08 KBDane Powell
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lioz’s picture

Assigned: Unassigned » Lioz
Status: Active » Needs work

Hi 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

All stylesheets within the same group that have the 'every_page' flag set to TRUE and do not have 'preprocess' set to FALSE are aggregated together into a single aggregate file, and that aggregate file can be reused across a user's entire site visit

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?

Dane Powell’s picture

css3.css and css3_graphics.css are put into two different aggregate files because they are in separate 'groups' (from template.php):

<?php
    drupal_add_css($path_to_theme . '/css/css3/css3.css', array('group' => CSS_THEME + 1,'every_page' =>TRUE));
    drupal_add_css($path_to_theme . '/css/css3/css3_graphics.css', array('group' => CSS_THEME + 2,'every_page' =>TRUE));
?>

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...

Dane Powell’s picture

Version: 7.x-3.0-beta9 » 7.x-3.0-beta11
Status: Needs work » Needs review
FileSize
1.08 KB

Simple patch- works great for me