diff -ur .htaccess .htaccess --- .htaccess 2006-11-29 06:16:14.000000000 +0000 +++ .htaccess 2006-12-04 09:11:22.000000000 +0000 @@ -85,6 +85,10 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] + +# If browser accepts gzip, and the .css.gz file exists, then use it + RewriteCond %{HTTP:Accept-encoding} gzip + RewriteCond %{REQUEST_FILENAME}.gz -f + RewriteRule ^(.*).css $1.css.gz [L,QSA] # $Id: .htaccess,v 1.78 2006/11/29 06:16:14 drumm Exp $ diff -ur includes/common.inc includes/common.inc --- includes/common.inc 2006-12-03 17:44:11.000000000 +0000 +++ includes/common.inc 2006-12-04 09:11:11.000000000 +0000 @@ -1414,7 +1414,7 @@ $path = $directory_path .'/css/'; if (!file_exists($path . $filename)) { - drupal_build_css_cache($types, $filename); + drupal_build_css_cache($types, $filename, $cache_css); } $output .= ''. "\n"; @@ -1444,7 +1444,7 @@ * @return * The name of the CSS file. */ -function drupal_build_css_cache($types, $filename) { +function drupal_build_css_cache($types, $filename, $cache_css) { $data = ''; // Create the css/ within the files folder. @@ -1486,6 +1486,10 @@ // Create the CSS file. file_save_data($data, file_create_path('css') .'/'. $filename, FILE_EXISTS_REPLACE); + + if ($cache_css == 'whitespace_gzip') { + file_save_data(gzencode($data), file_create_path('css') .'/'. $filename .'.gz', FILE_EXISTS_REPLACE); + } } /** diff -ur modules/system/system.module modules/system/system.module --- modules/system/system.module 2006-12-03 17:44:10.000000000 +0000 +++ modules/system/system.module 2006-12-04 09:13:20.000000000 +0000 @@ -679,7 +679,10 @@ '#type' => 'select', '#title' => t('Cache and compress CSS files'), '#default_value' => variable_get('cache_css', FALSE), - '#options' => array(t('Disabled'), t('Enabled')), + '#options' => array( + FALSE => t('Disabled'), + 'whitespace' => t('Enabled (whitespace compression)'), + 'whitespace_gzip' => t('Enabled (whitespace & gzip compression)')), '#description' => t("A lot of Drupal modules include their own CSS files. When these modules are enabled, each module's CSS file adds an additional HTTP request to the page, which can slow down the loading time of each page. These HTTP requests can increase the server load. It is recommended to only turn this option on when your site is in production, as leaving it on can interfere with theming development."), );