Last updated August 26, 2009. Created on May 19, 2005.
Edited by ronald_istos, alexanderpas, BioALIEN, m1mic. Log in to edit this page.

The theme_stylesheet_import function can be overwritten to omit drupal.css. Simply add the following snippet to the theme's template.php file:

<?php
/*
  Do not include drupal's default style sheet in this theme !
*/
function phptemplate_stylesheet_import($stylesheet, $media = 'all') {
  if (
strpos($stylesheet, 'misc/drupal.css') === 0) {
    return
theme_stylesheet_import($stylesheet, $media);
  }
}
?>

Replacing drupal.css with a custom .css file:

<?php
function phptemplate_stylesheet_import($stylesheet, $media = 'all') {
  if (
strpos($stylesheet, 'misc/drupal.css') !== 0) {
   
$stylesheet = str_replace('misc/drupal.css', 'misc/mysite.css', $stylesheet);
  }
  if (
strpos($stylesheet, 'misc/drupal.css') === 0) {
    return
theme_stylesheet_import($stylesheet, $media);
  }
}
?>

Placement of this snippet into the theme's template.php file will switch out the drupal.css file with a custom .css file. Replacing drupal.css can be useful on sites that do not want to be identified as using Drupal on the back end. This example copied the original drupal.css file, renamed it to mysite.css, and was saved in a directory named misc.

Note on using strpos from PHP.net:

Warning -- This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE, such as 0 or "". Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.