Today:

      // maybe this should get abstracted
      $zen_css_files = array(
        array('file' => 'fonts.css', 'scope' => 'all'),
        array('file' => 'zengine.css', 'scope' => 'all'),
        array('file' => 'layout.css', 'scope' => 'all'),
        array('file' => 'icons.css', 'scope' => 'all'),
        array('file' => 'colors.css', 'scope' => 'all'),
        array('file' => 'print.css', 'scope' => 'print'),
      );

Future?

      // maybe this should get abstracted
      $zen_css_files = array(

        array('file' => 'layout-1.css', 'layout-2.css', 'layout-3.css', 'scope' => 'all'),
     );

Then in the zen.info file(the theme) we can say:

layout-1.css = story
layout-2.css = book
layout-3.css = forum

Just thinking out load here.

CommentFileSizeAuthor
#3 zengine-better-css-handling-patch.txt4.31 KBjjeff

Comments

morphir’s picture

And say you wanna combine, this layouts with differents color.css files, like this:

layout-1.css, color-2.css, typography-1.css = story
layout-2.css, color-2.css, typography-1.css = book
layout-3.css, color-4.css, typography-1.css = forum

Now we are cooking cascading style sheets!

bON appetitè! ;)

morphir’s picture

Title: Better segregation of CSS files » Better segregation of CSS files and more flexibility

I forgot to mention that colors(palettes) and typography(fonts and size) are really what brands the site in terms if design. Pages often can have different layouts, whitout changing colors or typography.

So I would love some way to mix css files, with just specifying them like I did in the example above.

jjeff’s picture

StatusFileSize
new4.31 KB

Here's a patch that creates a new hook in a theme's template.php file. Here's an example:

/**
 * Add/modify/remove CSS files for the current page 
 */
function _zenzen_css(&$css, $vars) {
  if ($vars['node']->type == 'blog') {
    // if you're on a blog entry page
    $css['layout']['file'] = 'layout-blog.css';
  }
  if (arg(0) == 'admin') {
    // if you're in the admin section of the site
    $css['fonts']['file'] = 'fonts-admin.css';
  }
  // include a dynamic CSS file that is stored in the files directory:
  $css['dynamic'] = array(
    'file' => 'layout-maker.css',
    'path' => 'files/layout-maker',
  );
  // don't ever include the colors.css file
  unset($css['color']);
}

This patch isn't well tested yet, but it's also not spitting out any errors! ;-)

jjeff’s picture

Hmmm... there's a major bug in that patch... trying to track it down. Sorry.

jjeff’s picture

I take it back. I think it was an error in the PHPTal engine. Removed PHPTal and we're back in business.

morphir’s picture

It did not break the engine. But you will however need to create a CSS-directory in either the zengin-dir and move the style.css from root into /CSS. Or as I did, move the style.css into the CSS dir located in the zen zen theme. Also, I noticed the images disapeard:P But that one is easy to fix. Jeff: Is the CSS files in the zengine there as a fallback incase you did forget to ass css properties in your theme?

morphir’s picture

errr.. I did mean: In case you forgot to add CSS to your theme, is that the reason we have CSS-files in the engine directory?

jjeff’s picture

Status: Active » Fixed

I've committed this code, so just do an update and everything should end up in the right place.

Anonymous’s picture

Status: Fixed » Closed (fixed)