Drupal and generic CMS question

…there’s no getting around core stylesheets that define nodes, navigation etc… I often reset ul.menu, ul.menu li, li.leaf, etc… in my boilerplate css for that specific purpose.

How do you work that one out? Unless you’re specifically talking about over-riding those styles for logged-in users, but I’m not sure whether that’s what you meant. If not, then I have to disagree, per what I wrote earlier, because there are no Drupal core- or module-generated stylesheets that have to be served up to anon users. OK, so you can’t (as far as I’m aware) pick and choose: it’s an all or nothing deal, but that’s fine by me, since 99.9% of it would have had to be over-ridden in my theme CSS anyway. Discriminating by logged-in status is very simple to do.

Well, maybe we’re talking about something different. Yes it is all or nothing but anonymous visitors still get some core stylesheets. ie:

  • /modules/system.menus.css
  • /modules/system/system.base.css
  • /system/system.theme.css
  • /modules/node/node.css

I don’t usually bother much with overriding the style declarations within them however I do override the declarations for the menu system and I also make a point of getting rid of the top rule in tbody for any tabular content in the body copy area.

That’s all.

No, bud. Honestly, I’m not serving any of those core stylesheets to anon users. None of them. Here’s what I use:

<?php if ($GLOBALS['user']->uid > 0) { print $styles; } ?>

With that, user ID 0 (anon) gets max. 1 to 2 stylesheets (EDIT: my own, I mean).

So how does that work? I assume you’ve got that in html.tpl.php instead of the regular: <?php print $styles; ?> statement?

How are you applying your own stylesheet then? Is it hardcoded into your html.tpl.php somewhere after your conditional?

Yeah, that’s right. After that comes the regular stylesheet links with conditional comments and media attributes as needed. Simpler that way and almost certainly easier on the CMS.

Very cool idea… I usually use theme.info to list out my stylesheets and then aggregate & compress but your method definitely prevents any slag from getting through. Thanks for pointing that out.

Cheers. I occasionally have a bright idea! :wink: