Disabling all Drupal CSS files
by jake ~ December 15th, 2008. Filed under: Drupal.We needed to disable all of Drupal’s CSS files from our theme. Here’s how we did it:
function THEMENAME_preprocess(&$variables) {
// Get rid of all of Drupal's CSS files
$css = drupal_add_css();
foreach ($css['all']['module'] as $file => $status) {
if (!strstr($file, 'modules/MYMODULE')) {
unset($css['all']['module'][$file]);
}
}
$variables['styles'] = drupal_get_css($css);
We also wanted (no *real* need) to use screen.css rather than style.css, so we edited THEMENAME.info to have this:
stylesheets[all][] = reset.css stylesheets[all][] = screen.css
… and we removed the line for style.css from it.
Finally, as the superuser we went to /admin/build/modules (or /themes, can’t remember now) to refresh the theme cache. We also had to tick to enable the theme at /admin/build/themes as although we’d been using the theme for ages quite fine, it wasn’t actually ticked before.
And hey presto, it worked. Should probably add that it took waaaay too long to do though, so though we’d add this snipped for others to read.

December 15th, 2008 at 8:39 pm
Any way this could be a module? I can definitely see the advantage of disabling all style properties for the admin to get through things faster. Might be cool if there was a way to strip out all javascript / CSS that wasn’t system critical for a bare-bones admin view. A lot of times I make a theme called “blank” and just load stuff up w/o styling though this definitely seems like it would be faster.
May 1st, 2009 at 3:12 am
Try this one – http://drupal.org/project/stylestripper – it’s super sweet and very underused!
Cheers,
Adam