Remove core and contrib style sheets

« Back :: Tagged with CSS :: Drupal :: Drupal 6.x :: HowTo's :: Snippets :: template.php ::

Ever wanted to remove unwanted style sheets? Here's the snippet.

/**
 * Remove core and contrib style sheets
 */ 
function phptemplate_preprocess_page(&$vars) {
  $css = $vars['css'];
  
  // remove core css
  unset($css['all']['module']['modules/user/user.css']);
  unset($css['all']['module']['modules/node/node.css']);

  // remove contrib css
  $rm[] = drupal_get_path('module','filefield').'/filefield.css';
  $rm[] = drupal_get_path('module','fieldgroup').'/fieldgroup.css';
  $rm[] = drupal_get_path('module','forward').'/forward.css';
  
  // unset selected
  foreach ($rm as $key => $value) {
    unset($css['all']['module'][$value]);
  }
 
  // put remaining files back in the $styles variable
  $vars['styles'] = drupal_get_css($css);
}

 

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <blockquote> <blockcode> <pre> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Copyright © 2010 deuxcode.com
Powered by Drupal. Valid XHTML 1.0 Strict and CSS 2.1.