A popular technique to remove a CSS files from a Drupal 7 website is to use the "FOAD" (F*** off and Die) technique.

The trick is to tell Drupal to load a CSS file with the same name as the stylesheet you'd like to remove. Do this by editing the themename.info file within your theme. You need not create an actual empty stylesheet file, simply list the css filename in the .info file.

Drupal will try to load the stylesheet you've listed instead of the stylesheet from the module, but it will come up empty-handed. Thus the styles from the module stylesheet are not loaded at all.

  1. Open the themename.info file
  2. Add the filenames to the stylesheets[all][] list
  3. Save your .info file and clear the Drupal site cache

For example, to override the system.messages.css, comment.css, and node.css to remove their default styling:
themename.info

;-------------- CSS FOAD -------------
stylesheets[all][] = system.messages.css
stylesheets[all][] = comment.css
stylesheets[all][] = node.css

Voila! You never have to overwrite those styles again.

More information about this is avaible at Overriding style sheets from modules and base themes

Comments

bradallenfisher’s picture

Wouldn't this hurt performance since a check for the file still needs to be made?

pjbrydon’s picture

Wouldn't a check for a file be made regardless of whether you include that? They're loading the default ones from somewhere! Besides, Drupal 7 has optimization that puts the results together in a single file. Add caching and well... I think the answer is no.

CSE majors think too hard these days about minute optimizations. (Optimize it -after- you have something that works, and only if you need to.) :)

killes@www.drop.org’s picture

This is a very bad idea.

This causes a file not found error for such files when aggregation is used.

You should at the very least add an empty file.

Or use hook_css_alter in template.php.

Or use e.g. magic.module which allows you to configure this.