A hidden gem for theme developers

Published on Sat, 2007-12-15 - 16:46

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().

Tags
The comments for this post are now closed. If you have corrections, suggestions, or other feedback, you can reach me through the contact page.