You are here

function css_gzip_copy_compress in CSS Gzip 6

Read and compress the css files.

Parameters

$css_files: Array of css filenames.

2 calls to css_gzip_copy_compress()
css_gzip_exit in ./css_gzip.module
Implementation of hook_exit().
css_gzip_preprocess_page in ./css_gzip.module
Implementation of template_preprocess_page().

File

./css_gzip.module, line 191
Gzips aggregated CSS files if CSS Optimization is turned on.

Code

function css_gzip_copy_compress($css_files) {
  foreach ($css_files as $css_file) {
    if (file_exists(file_directory_path() . '/css/' . $css_file) && !file_exists(file_directory_path() . '/css/' . $css_file . '.gz')) {
      file_save_data(gzencode(file_get_contents(file_directory_path() . '/css/' . $css_file), 9), file_directory_path() . '/css/' . $css_file . '.gz', FILE_EXISTS_REPLACE);
    }
  }
}