I have optimized to combine all CSS and JavaScript files in my site.

image 1.

If I run Yslow in Firefox to see the components loaded for this site, it shows that it loads 8 JavaScript files, and 8 CSS files.

image 2

Why aren't these files combined?


1 Answer 1


Aggregated CSS and JS files in Drupal 7 are split up into groups, so you'll naturally get more files than you're used to seeing in Drupal 6.

I won't go in to the whole thing as there's already an excellent article out there that explains it in good detail.

D7 uses a new strategy to address this - aggregates are split into three groups: CSS_SYSTEM, CSS_DEFAULT, and CSS_THEME for styles, and JS_LIBRARY, JS_DEFAULT, and JS_THEME for Javascript. Each group is further subdivided into files that load on every page, and files that load conditionally based on the 'every_page' option. Note this option has some potential for confusion - it doesn't cause the file to be loaded on every page - it's merely a "hint" to the core system to place it in that group.

Ultimately, the intent of these divisions is to group files into functional groups that are smaller and less likely to be split by an errant conditional style or script. We get separate files for core libraries, the theme, and page-specific files. Looking at the results, a stock Drupal 7 outputs eight stylesheets (including browser styles), while D6 only has three in the default install. Is this optimal? The answer will be different for each site.

If it's causing you problems, you might want to have a look at the Core Library module:

This module changes the Drupal core aggregation mecanism process. It greatly reduces I/O and aggregated number of files, and improves chances of client cache hit, therefore while it produces bigger aggregated files, it reduces greatly the bandwidth utilization while users browse.

  • Great article I'm going to leave the files as it.
    – chefnelone
    Commented May 12, 2012 at 20:04
  • Also add that AdvAgg can be used to force larger groups.
    – mikeytown2
    Commented Feb 11, 2015 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.