To allow for minor tweaking of the Garland theme without having to sub-theme it, it would be nice if it could just check for a site-specific custom CSS file, and include that if found.

I don't know too much about PHP or the Drupal internals, but this looks like it might just work:

<?php
if (file_exists($custom_css = conf_path() .'/custom.css')) {
  drupal_add_css($custom_css);
}
?>

Then inside each install place your custom.css and it'll pick it up.

for example:
"sites/example.com/custom.css"
"sites/sub.example.com/custom.css"
etc..

Each install will load their own custom style sheet.

I found another way to achieve the same end that gets mostly around sub-theming and does not involve hacking Garland, but is much more complicated. Having the opportunity to just add a custom CSS would make minor tweaking much more feasible.

Comments

rondp’s picture

I meant to include the source of the quote in my request but only noticed too late that it isn't there.
So here it is: http://drupal.org/node/177805#comment-274004

rondp’s picture

Version: 6.6 » 6.8

Hm, any comments, anyone?
Is this a reasonable request? Is it in the right place or would it belong elsewhere? If so, where?
TIA,
Ronald

ultimateboy’s picture

Component: Garland theme » theme system
Status: Active » Closed (won't fix)

Check out the CSS Injector module. It should take care of your needs http://drupal.org/project/css_injector

rondp’s picture

Thanks for your reply and the pointer, ultimateboy.
It seems that CSS Injector does what I am after, and much more.

I still think that a point could be made for having a simple generic way to include custom CSS files, without having to sub-theme or install a module. Perhaps not as a feature of any particular theme but of the template engine?

Anyway, my immediate needs are met with the module, so thanks again.

rondp’s picture

After messing around with this quite a bit, I'd say that CSS Injector is good, but just can't really do what I am after, or only with side effects.
There's this warning on the config page for the module:

[quote]An important point to keep in mind is that in Drupal, themes always get last crack at display. Theme CSS is applied after modules. That means themes can and will override CSS put into play by CSS Injector module. If you want to override CSS that a theme is already applying, use CSS rules the way they were intended -- higher specificity rules, or the !important flag.[/quote]

Since overriding theme styles is exactly what I'm after, the !important flag is what I would have to use, but as I understand it that has side effects with regards to what the client can do (e.g. font sizes, which is an issue in my case). So in my opinion it would still be great to have a generic custom CSS inclusion feature.
Just not sure whether anyone will look at this thread anymore at all (since it's marked "won't fix" and therefore off the map for most people) or if I should start a new one.

Cheers,

Ronald

ultimateboy’s picture

Honestly, I think that if you are looking to change a theme beyond what CSS Injector is doing, then you should just... modify the theme. Sure you loose the upgradability of the theme.. but if you are wanting something that different from a contrib theme, I recommend simply making the changes in the theme itself.

nerkn’s picture

I think it shouldn't hard to implement and also very good advantage for us (multisite users, uptodate users)

Css means we can change layout without coding in php, or html structure.

What is the idea behind that restriction?

rondp’s picture

ultimateboy,

The thing is that the changes I have in mind are very, very simple. Something like making menu items bold.
In fact I don't need all the functionality of CSS injector or of a module in general.
However CSS injector cannot do it for me, and not because my changes would be so far-reaching, but simply because of the order in which the changes are applied - the changes I make in CSS injector are overridden by the directives in the theme itself because those are applied afterwards.
I'm not trying to be argumentative, but considering how simple it is to just include a custom css file if it exists (I seem to have seen another mechanism where this was done through the .info file, even simpler), I wonder why this could not be made a generic feature of the template engine - I think it would be a nice and useful one.

Cheers,

Ronald