Mikkel Høgh

A hidden gem for theme developers

Saturday, December 349th, 2007

I was doing some work on a site today, and I found me in a bit of a jam. I’d rather not spend a lot of time (as I have done so far) writing all kinds of code to get aroud Drupal’s default styling.

I’d also rather not completely forego Drupal’s CSS, because nice modules like admin menu depends on it. So what to do?

After digging a lot around in the docs (which are, sadly, a bit confusing on the subject), I did a print var_dump($css); in my template, and figured out that all I had to do was to put unset($css['all']['module']); in my template.php page.tpl.php and then add my own CSS files as such: drupal_add_css(path_to_theme().'/reset-fonts-grids.css', 'theme', 'all');

Be careful with this, since most module-related CSS is put into $css['all']['module'], so if you need any of that, you’ll have to unset the values of the $css['all']['module'] array one by one, or just add the CSS file again with drupal_add_css().


Mikkel Høgh

My name is Mikkel Høgh, I've worked with web tech for the last 20 years. These days, I work with e-commerce in Central Switzerland.