As per quick chat with Unconed on IRC a few days ago.

This patch gets rid of the

instruction that loads the original style.css even when the color scheme is modified. The modified code takes care of unsetting $vars['css']['all']['theme'][(theme's path/style.css)] so that the stylesheet doesn't get imported needlessly. There are many ways to go around this... please review. Cheers. :-)
CommentFileSizeAuthor
#2 color.module.patch711 bytesdrumm
color.module_2.patch446 bytesefolia
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ms2011’s picture

Was just browsing issues and noticed this post. I agree the original style.css should be removed and this functionality should be part of the color.module. In the meantime, I thought I'd share my approach to remove the original style.css, which goes in the theme's template.php file...

NOTE: This also removes the Drupal module stylesheets but you can remove those two lines and change the else if to an if, if you don't like doing things that way.

/**
 * Do NOT include Drupal module stylesheets in this theme.
 */
function _phptemplate_filter_styles(&$var) {
  $css = &$var['css']; // alias

  // remove any CSS files NOT related to this theme
  foreach ($css as $media => &$types)
    foreach ($types as $type => &$files)
      if ($type != 'theme')
        unset($css[$media][$type]);
      else foreach (array_keys($files) as $file) // also remove files overwritten by color.module
        if (preg_match('!^files/color/.+$!i', $file, $matches))
          $css[$media][$type] = array($file => TRUE);

  $var['styles'] = drupal_get_css($css); // a string of XHTML CSS tags
}

/**
 * Override or insert PHPTemplate variables into the templates.
 */
function _phptemplate_variables($hook, $vars) {
  if ($hook == 'page') {

    if ($secondary = menu_secondary_local_tasks()) {
      $output = '<span class="clear"></span>';
      $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
      $vars['tabs2'] = $output;
    }

    // Hook into color.module
    if (module_exists('color')) {
      _color_page_alter($vars);
    }

    // Filter unnecessary stylesheets
    _phptemplate_filter_styles($vars);

    return $vars;
  }
  return array();
}

Hope this helps someone!

drumm’s picture

Version: 5.1 » 6.x-dev
FileSize
711 bytes

Here is an updated version of efolia's patch, with a bit more simple code style.

dpearcefl’s picture

Status: Needs review » Postponed (maintainer needs more info)

Is this still a problem in current D6?

dpearcefl’s picture

Status: Postponed (maintainer needs more info) » Needs work

We want your patch if it is still needed. Please resubmit it with a proper filename.

http://drupal.org/node/1054616
[description]-[issue-number]-[comment-number].patch

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.