Return to Snippet

Revision: 11677
at January 25, 2010 13:55 by troynt


Updated Code
/* simple example */
function phptemplate_preprocess_page(&$vars)
{
  drupal_add_css(THEMEPATH.'/css/sifr.css','theme');
  $css = drupal_add_css();
  //unset($css['all']['module']['modules/system/system.css']);
  //unset($css['all']['module']['modules/system/defaults.css']);
  //unset($css['all']['module']['modules/system/system-menus.css']);
  unset($css['all']['module']['modules/user/user.css']);
  unset($css['all']['module']['modules/taxonomy/taxonomy.css']);
  unset($css['all']['module']['sites/all/modules/cck/theme/content-module.css']);
  unset($css['all']['module']['sites/all/modules/logintoboggan/logintoboggan.css']);
  unset($css['all']['module']['sites/all/modules/ubercart/uc_product/uc_product.css']);
  unset($css['all']['module']['sites/all/modules/cck/modules/fieldgroup/fieldgroup.css']);
  unset($css['all']['module']['sites/all/modules/filefield/filefield.css']);
  unset($css['all']['module']['sites/all/modules/img_assist/img_assist.css']);
  unset($css['all']['module']['sites/all/modules/link/link.css']);
  $vars['styles'] = drupal_get_css($css);
}

/* whitelist */
function pbot_preprocess_page(&$v)
{
  $css = drupal_add_css();
  foreach( $css['all']['module'] as $stylesheet => $val )
  {
    $matches = array();
    preg_match('@(devel|date|wysiwyg|tinymce|admin_menu|imce)@',$stylesheet,$matches);
    if( strpos($stylesheet,'sites/all/modules') !== false && empty($matches) )
    {
      unset($css['all']['module'][$stylesheet]);
    }
  }

  $v['styles'] = drupal_get_css($css);
}

Revision: 11676
at April 16, 2009 17:46 by troynt


Updated Code
function phptemplate_preprocess_page(&$vars)
{
  drupal_add_css(THEMEPATH.'/css/sifr.css','theme');
  $css = drupal_add_css();
  //unset($css['all']['module']['modules/system/system.css']);
  //unset($css['all']['module']['modules/system/defaults.css']);
  //unset($css['all']['module']['modules/system/system-menus.css']);
  unset($css['all']['module']['modules/user/user.css']);
  unset($css['all']['module']['modules/taxonomy/taxonomy.css']);
  unset($css['all']['module']['sites/all/modules/cck/theme/content-module.css']);
  unset($css['all']['module']['sites/all/modules/logintoboggan/logintoboggan.css']);
  unset($css['all']['module']['sites/all/modules/ubercart/uc_product/uc_product.css']);
  unset($css['all']['module']['sites/all/modules/cck/modules/fieldgroup/fieldgroup.css']);
  unset($css['all']['module']['sites/all/modules/filefield/filefield.css']);
  unset($css['all']['module']['sites/all/modules/img_assist/img_assist.css']);
  unset($css['all']['module']['sites/all/modules/link/link.css']);
  $vars['styles'] = drupal_get_css($css);
}

Revision: 11675
at February 13, 2009 12:11 by troynt


Initial Code
function phptemplate_preprocess_page(&$vars)
{
  $css = $vars['css'];
  unset($css['all']['module']['modules/system/system.css']);
  unset($css['all']['module']['modules/system/defaults.css']);
  $vars['styles'] = drupal_get_css($css);
}

Initial URL

                                

Initial Description
Put this in the template.php within your template directory.

Initial Title
Remove Unwanted Stylesheets from Drupal 6

Initial Tags
css, drupal

Initial Language
PHP