Best CSS and JS aggregation/minification strategy for D7 Drupal 6 has the awesome advagg module, which does an awesome job of intelligently bundling CSS and JS, but currently no D7 release.

What I am looking to achieve is:


less CSS and JS files (5 CSS and 5 JS files is far too many)
JS files have minification (currently core only does this for CSS)


Is there a drupal 7 solution that will help here? What are other people's experience with optimising this?



Edit: The question was originally posted in 2011. There is now a very stable D7 release of advagg.
For D7, there's Core Library which has a learning mode that aggregates based on real-world statistics about your site.

If you want to brute-force everything into one giant aggregate, I've written an article with some sample code:

/**
 * Implements hook_js_alter().
 */
function mymodule_js_alter(&amp;$javascript) {
  uasort($javascript, 'drupal_sort_css_js');
  $i = 0;
  foreach ($javascript as $name =&gt; $script) {
    $javascript[$name]['weight'] = $i++;
    $javascript[$name]['group'] = JS_DEFAULT;
    $javascript[$name]['every_page'] = FALSE;
  }
}

/**
 * Implements hook_css_alter().
 */
function mymodule_css_alter(&amp;$css) {
  uasort($css, 'drupal_sort_css_js');
  $i = 0;
  foreach ($css as $name =&gt; $style) {
    $css[$name]['weight'] = $i++;
    $css[$name]['group'] = CSS_DEFAULT;
    $css[$name]['every_page'] = FALSE;
  }
}


Drupal.org issue #1034208 also proposes relaxing the strict ordering requirements slightly.