I think it would be benefiticial to consider integrating with conditional styles module:

http://drupal.org/project/conditional_styles

Zen theme does so and I'm eager to add a clean way for conditional stylesheets to be added to the main theme and also sub themes in general.

Comments

psynaptic’s picture

Status: Active » Fixed

No one seems to want this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

adrinux’s picture

Title: Integrate with conditional styles module » Add Zen type conditional styles support
Status: Closed (fixed) » Needs review
StatusFileSize
new4.1 KB
new4.91 KB

This is a basic port of the conditional styles module code as used by Zen. It allows IE conditional stylesheets to be linked in info files instead of just pasted into the head of page.tpl.php.

This patch probably needs some work yet, including some documentation, but is functional. Also attached is the conditional styles inc from zen which is required (cvs won't let me add and thus produce a patch with it included?). You need to rename it to "template.conditional-styles.inc", it's not actually a patch.

As a bonus this fixes a bug in the clean sub themes, they were including the base themes ie fix css like so:

<!--[if lt IE 8]><link type="text/css" rel="stylesheet" media="all" href="<?php print $path; ?>/css/ie-lt8.css" /><![endif]-->

Which was giving the following broken link:

<!--[if lt IE 8]><link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/clean/subthemes/clean_1kb//css/ie-lt8.css" /><![endif]-->

So with this patch all subthemes except clean_1kb now correctly inherit the base theme's IE fix stylesheet. There's an issue with clean_1kb sub theme because it has this in it's template.php:

  // Rebuild styles variable.
  $variables['styles'] = drupal_get_css(clean_css_stripped());

Which appears to wipe off the conditional css stylesheets. Need to experiment with a fix for that.

adrinux’s picture

StatusFileSize
new6.29 KB

A small tweak to the patch that gets things working in clean_1kb. You'll still need a copy of template.conditional-styles.inc as above to get this patch working.

Just needs some documentation in the readme.txt I think, and it's good to go, unless anyone else has a comment...

adrinux’s picture

StatusFileSize
new8.08 KB

A third patch with a little documentation in the readme. Also removes a big chunk of seemingly out of date text from the read me.

I've gone as far as I can with this. Needs review!

adrinux’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new7.31 KB

Final patch after code cleanup and readme text changes suggested by psynaptic.

adrinux’s picture

Status: Reviewed & tested by the community » Fixed

Patch from #6 Committed along with template.conditional-styles.inc

Marking fixed.

psynaptic’s picture

Awesome, thanks adrinux!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.