You are here

function cdn_css_alter in CDN 7.2

Implements hook_css_alter().

Ensure that CDN-blacklisted CSS files are not aggregated, so that the CSS aggregates can still be served from the CDN.

File

./cdn.module, line 255

Code

function cdn_css_alter(&$css) {
  if (!cdn_status_is_enabled()) {
    return;
  }

  // If all CSS files are blacklisted, return early, otherwise we'd end up
  // disabling preprocessing (aggregation) for every CSS file, hence disabling
  // aggregation altogether.
  if (!cdn_check_file('*.css')) {
    return;
  }
  foreach (array_keys($css) as $key) {

    // Skip $type = 'inline'.
    if (is_numeric($key)) {
      continue;
    }
    elseif (!cdn_check_file($key)) {
      $css[$key]['preprocess'] = FALSE;
    }
  }
}