m3avrck and I discussed the use of @import in css files and why they shouldn't be used with Drupal 5.

1) Right now we're only using @import for all styles, where one of it's really big advantages is including different screen/print versions of the same files.
2) A seperate HTTP request is made for every CSS file. Meaning that just to load the CSS in Zen, it requires 3 or more requests.
3) Most importantly, the CSS preprocessor in Drupal 5 doesn't support compressing files through @import

A couple of options to get around this:

1) Put all the css files together
2) Use drupal_add_css() to add the icons.css and layout.css in template.php in the _phptemplate_variables()

Comments

moshe weitzman’s picture

2) is what I do in bluebeach theme for groups.drupal.org. actually, i had to do the drupal_add_css in the global scope (i.e. not inside a function) in order for the css file to show in all cases.

jjeff’s picture

Ahhh... Interesting point...

We hit a bit of a problem with the subthemes though. For example, the Zen-Fixed theme basically only consists of 2 or three lines of code and then several @import declarations to include files from the parent directory.

This is a good example of where subthemes should actually cascade the template.php, page.tpl.php, node.tpl.php, etc...

I'm going to need to do a bit of thinking about this one to come up with an elegant solution.

quicksketch’s picture

I use this approach:

function _phptemplate_variables($hook, $vars = array()) {
  switch ($hook) {
    case 'page':
      // add CSS for all pages
      drupal_add_css($vars['directory']. '/css/layout.css', 'theme');
      drupal_add_css($vars['directory']. '/css/icons.css', 'theme');
      drupal_add_css($vars['directory']. '/css/style.css', 'theme');
      $vars['styles'] = drupal_get_css();
      break;
  }
}
jjeff’s picture

Committed major change that fixes this problem, but addresses subtheme issues too... also adds the ability for subthemes to define their own node.tpl.php, block.tpl.php, etc...

jjeff’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)