diff -u includes/theme.inc includes/theme.inc --- includes/theme.inc 24 Aug 2010 23:26:52 -0000 +++ includes/theme.inc 25 Aug 2010 08:33:07 -0000 @@ -2276,15 +2276,29 @@ // Add CSS and JS declared in module .info files. foreach (system_get_info('module') as $module => $info) { if (!empty($info['stylesheets'])) { - foreach ($info['stylesheets'] as $media => $stylesheets) { - foreach ($stylesheets as $stylesheet) { - drupal_add_css($stylesheet, array('media' => $media, 'preprocess' => TRUE)); + foreach ($info['stylesheets'] as $permission => $medias) { + // If a stylesheet is associated with a permission then we check access + // before adding it, causing files to aggregate by role combinations. + // If it has no associated permission, then it is always added. + if (is_numeric($permission) || user_access($permission)) { + foreach ($medias as $media => $stylesheets) { + foreach ($stylesheets as $stylesheet) { + drupal_add_css($stylesheet, array('media' => $media, 'preprocess' => TRUE)); + } + } } } } if (!empty($info['scripts'])) { - foreach ($info['scripts'] as $script) { - drupal_add_js($script, array('preprocess' => TRUE)); + foreach ($info['scripts'] as $permission => $scripts) { + // If a script is associated with a permission then we check access + // before adding it, causing files to aggregate by role combinations. + // If it has no associated permission, then it is always added. + if (is_numeric($permission) || user_access($permission)) { + foreach ($scripts as $script) { + drupal_add_js($script, array('preprocess' => TRUE)); + } + } } } } diff -u modules/aggregator/aggregator.info modules/aggregator/aggregator.info --- modules/aggregator/aggregator.info 24 Aug 2010 23:26:53 -0000 +++ modules/aggregator/aggregator.info 25 Aug 2010 08:33:07 -0000 @@ -16 +16 @@ -stylesheets[all][] = aggregator.css +stylesheets[access news feeds][all][] = aggregator.css diff -u modules/book/book.info modules/book/book.info --- modules/book/book.info 24 Aug 2010 23:26:53 -0000 +++ modules/book/book.info 25 Aug 2010 08:33:07 -0000 @@ -13 +13 @@ -stylesheets[all][] = book.css +stylesheets[][all][] = book.css diff -u modules/comment/comment.info modules/comment/comment.info --- modules/comment/comment.info 24 Aug 2010 23:26:54 -0000 +++ modules/comment/comment.info 25 Aug 2010 08:33:07 -0000 @@ -15 +15 @@ -stylesheets[all][] = comment.css +stylesheets[access comments][all][] = comment.css diff -u modules/field/field.info modules/field/field.info --- modules/field/field.info 24 Aug 2010 23:26:55 -0000 +++ modules/field/field.info 25 Aug 2010 08:33:08 -0000 @@ -18 +18 @@ -stylesheets[all][] = theme/field.css +stylesheets[][all][] = theme/field.css diff -u modules/forum/forum.info modules/forum/forum.info --- modules/forum/forum.info 24 Aug 2010 23:26:55 -0000 +++ modules/forum/forum.info 25 Aug 2010 08:33:08 -0000 @@ -15 +15 @@ -stylesheets[all][] = forum.css +stylesheets[][all][] = forum.css diff -u modules/node/node.info modules/node/node.info --- modules/node/node.info 24 Aug 2010 23:26:56 -0000 +++ modules/node/node.info 25 Aug 2010 08:33:08 -0000 @@ -16 +16 @@ -stylesheets[all][] = node.css +stylesheets[][all][] = node.css diff -u modules/poll/poll.info modules/poll/poll.info --- modules/poll/poll.info 24 Aug 2010 23:26:58 -0000 +++ modules/poll/poll.info 25 Aug 2010 08:33:09 -0000 @@ -12 +12 @@ -stylesheets[all][] = poll.css +stylesheets[][all][] = poll.css diff -u modules/search/search.info modules/search/search.info --- modules/search/search.info 24 Aug 2010 23:26:58 -0000 +++ modules/search/search.info 25 Aug 2010 08:33:09 -0000 @@ -14 +14 @@ -stylesheets[all][] = search.css +stylesheets[search content][all][] = search.css diff -u modules/simpletest/tests/common_test.info modules/simpletest/tests/common_test.info --- modules/simpletest/tests/common_test.info 24 Aug 2010 23:27:00 -0000 +++ modules/simpletest/tests/common_test.info 25 Aug 2010 08:33:10 -0000 @@ -7,4 +7,4 @@ files[] = common_test.module -stylesheets[all][] = common_test.css -stylesheets[print][] = common_test.print.css +stylesheets[][all][] = common_test.css +stylesheets[][print][] = common_test.print.css hidden = TRUE diff -u modules/user/user.info modules/user/user.info --- modules/user/user.info 24 Aug 2010 23:27:03 -0000 +++ modules/user/user.info 25 Aug 2010 08:33:12 -0000 @@ -15 +15 @@ -stylesheets[all][] = user.css +stylesheets[][all][] = user.css