Categories
Uncategorized

Drupal: Automatically preprocess css/js for IE

Internet Explorer has a well know bug limiting the number of stylesheets that in can load, see here. This introduces an inconvenient hassle when it comes time to test CSS updates on a Drupal site. You have to remember to go to the performance page and enable CSS preprocessing to get the number of files down to something IE can handle.

Or, if you prefer and are lazy, you can have it done automatically for you. The following snippet will automatically preprocess both CSS and Javascript files if you browse a site using Internet Explorer. Drop it into the settings.php file on your development/staging/test sites and enjoy the convenience!

if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
  $conf['preprocess_css'] = 1;
  $conf['preprocess_js'] = 1;
}