Well, my post to ZTF didn't get much feedback, let's try a patch here! :P

My aim is to take the base subtheme work done for #171464 and continue to evolve its CSS structure, making it more useful as a starting point for others creating their own subthemes. Like a lot of themers, I like what Zen tries to do, but get annoyed at having to 'un-theme' the default theme. I want a simpler way to get a more bare-bones Zen, without throwing out the default subtheme altogether. There's also a few 'best practice' things I'd like to see introduced here.

To start with, I propose breaking up zen-classic.css into 3 separate CSS files: zen-typography, zen-layout, and zen-presentation. Zen-typography deals primarily with fonts and font sizes, especially the stuff that helps ensure even sizing/scaling across browsers. Zen-layout is for creating the overall skeletal structure of the layout - header sizes, columns, margins, etc. Zen-presentation is for the chrome - things like color schemes and background images.

With this division, the most basic customization would be done in zen-presentation. A lot of users only want to change the color scheme and add their own logo. They can change a few values in zen-presentation and not have to worry about any of the others. Changes made here also have the least chance of breaking things, a boon to newbies. If coded to the same standard, zen-presentation files would be easily interchangeable. The result would be something like Winamp 2 skins, where everything is in the same place no matter what, but the appearance can change significantly. Not the ultimate in customization, but for a lot of people that's all they need. Meanwhile, a more experienced themer could simply remove the default contents of zen-presentation and have most of their un-theming work done in one stroke.

Advanced themers will be more comfortable hacking away at at zen-layout, getting down and dirty with the box model, floats, and fun things like that. Zen-layout files could potentially be interchangeable too, but would be more likely to require changes elsewhere. As an idea for down the road, I wonder if some type of layout mix-in system could be created. As a simple example, changing between fixed and fluid widths, without having to link yet another CSS file from the HTML.

Zen-typography would probably be the most universally-used of these three files. It's always good to have a common baseline for fonts across browsers, and the rest is mostly trivial edits.

The divisions between typographical, layout, and presentation are not always clear-cut. Like whether links are underlined or not, is that typography or presentation? As such, my current divisions are not necessarily perfect. The biggest question mark for me was margin and padding applied to elements that are normally a single line of text, like <h1>. Normally, margin and padding are placed in zen-layout, but on elements like this it functions more akin to line-height, and typically doesn't impact the overall layout structure. As such, I placed them in zen-typography instead. I could still be convinced to put them in zen-layout, though.

But things like that are just details, and this is just a draft. For the moment, I'm more interested in what people think of the idea in general. Probably the biggest drawback is just in having more stylesheets to deal with, especially when trying to determine where a particular value comes from. Still, you'll be aided by knowing the logic of the divisions. If you want to change something from being float: left to float: right, you know that it's probably going to be in zen-layout.css. And since each file is smaller, there's less code for you to have to scan over. A theme author would still be free to create their own theme that doesn't use any of these CSS files, or pick and choose from them. Of course, there will also be subthemes not based on zen-classic at all, but still there's sure to be plenty of zen-classic derivatives, so why not instill some good habits here?

This initial patch deals only with the division of zen-classic. Eventually changes to some of the other CSS files may be incorporated here as well. There's also some other cleanup issues I want to take on, but to start with I've decided to keep this as much of a 1:1 division as possible. And hopefully I've got Eclipse setup to create this patch right, my first time using it for that. :)

CommentFileSizeAuthor
zen-classic_division.txt31.12 KBToe

Comments

johnalbin’s picture

Have you seen the division of style sheets in the main theme of Zen 5.x-0.8?

Toe’s picture

Yes I have, in fact, the patch above was created against a cvs head snapshot of Zen taken just yesterday. As I said, I want to continue to build on what was done in #171464 in reworking the default subtheme.

My next step would probably be to look more closely at how things relate with regard to the other CSS files. For example, the current zen-classic.css (and by extension my zen-layout.css) and layout.css both contain code that can be described as 'layout'. Is there any clearly-defined difference between them? Could they be merged together? If we can come up with a solid delineation between them, it could probably serve as the base of the layout mix-ins idea I mentioned above.

I'm open to discussion, here.

Roz-pT’s picture

This is such a good ideia that it should be implemented by default with Zen. I am one of those CSS newbies who could really take advantage of this system, since I'm in the process of "un-theming" Zen for my web site, and all I really want to do for now is a complete change of colors, which is a pain in that big, scary, CSS file.

You've got my full suport!

johnalbin’s picture

As I said, I want to continue to build on what was done in #171464 in reworking the default subtheme.

zen_classic is not the default sub-theme of Zen. The SUBTHEME folder gives developers a starting point for creating sub-themes from Zen, so that should be considered the default sub-theme.

Take a look at the recent work in 5.x-1.x-dev; it is fast approaching a 5.x-1.0-beta1 release.

kdebaas’s picture

I was wondering if you wouldn't consider creating a separate subtheme to demonstrate your ideas instead? That has become remarkably easy, with the latest changes under the hood of Zen...

For the moment, I'm more interested in what people think of the idea in general. [...] What I propose is breaking up zen-classic.css (previously zen.css) into 3 separate CSS files: zen-typography, zen-layout, and zen-presentation. [...] The divisions between typographical, layout, and presentation are not always clear-cut. [...]Probably the biggest drawback is just in having more stylesheets to deal with, especially when trying to determine where a particular value comes from.

It's very sympathetic of you to raise the potential problems with this proposal yourself.

Toe’s picture

zen_classic is not the default sub-theme of Zen.

Fine, if we must be pedantic, 'example sub-theme for Zen.' But if you don't remove it altogether from the final release (which I think would be a bad idea), then intended or not people WILL look at it for guidance when creating their subtheme, and many will probably start their subtheme by modifying it rather than what's in the SUBTHEME folder. Thus I would like to make it a better example.

I was wondering if you wouldn't consider creating a separate subtheme to demonstrate your ideas instead?

For the reason I stated above I don't want to make this into its own subtheme. That said, I think I'm going to start making this into more of a real proof of concept stage, probably starting with an alternate zen-presentation.css. Hopefully I'll have time to work on it this weekend.

johnalbin’s picture

Status: Needs work » Active

Toe, I wasn't meaning to be pedantic. I was just clarifying the issue.

5.x-1.0-beta1 was released over the weekend and I re-implemented the zen_classic theme using the SUBTHEME starter kit. So it is a way better example sub-theme than it was.

So the screen CSS files are now broken up into:

  • html-elements.css
  • icons.css
  • layout-garland.css
  • zen-classic.css

html-elements is very similar to the zen-typography you proposed. It deals with styling basic html elements (with no classes or ids or minimal classes), which naturally have a lot of font specifications.

How you separate your CSS rules varies widely by developer, but I would encourage anyone to outline their preferred method as it would be helpful to myself and others to know the different methods.

I feel this issue is resolved, but if there are additional separations of zen-classic.css that you would like to do, feel free to update your proposal and post a patch. Thanks!

johnalbin’s picture

Status: Active » Fixed

Again, if you would like to update your proposal, feel free to re-open this issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

Toe’s picture

Title: Split up zen-classic.css » Split up CSS files into a library format
Component: Subtheme: Zen Classic » Code
Status: Closed (fixed) » Active

Tentatively reopening, at least for a few more comments. Ran into a period of the dreaded 'no time to work on project', followed by a bit of reevaluating my options.

I did a bit of searching around and found a CSS framework that's fairly close to my ideas, WYMstyle. If you want to 'know the different methods' I would suggest having a look at that. It makes use of a library of smaller fragments of CSS that can be mixed & matched somewhat arbitrarily, to a greater extent than Zen currently does.

At this point I'm focusing less on zen-classic.css, and more on the overall organizational structure of Zen's CSS (hence the title change). I picture the structure being something like this:

\zen
    \css_library
        \layout
            \base
                2_column_left.css
                2_column_right.css
                3_column.css
            \add-ins
                nav_horizontal.css
                nav_dropdown_menus.css
                grid.css
        \decoration        /* I think this is more descriptive than 'presentation' as I used above */
            black_and_white.css
            aero-ish.css
            flaming_polkadots.css
            \images
        \other
            typography.css
            ie_hacks.css
    \my_subtheme
        my_subtheme.info
        my_layout.css
        my_decoration.css
        print.css
        handheld.css
        \images

If you look in WYMstyle, under \sites\test, there's a set of 4 small test CSS files. Each of these is mainly just a list of imports of other CSS files from a library (\core in theirs, \css_library in my example). The 4 files vary only in which lines are commented out, ie which files in the list are imported and which aren't. This is essentially what I picture style.css becoming, a master that specifies which other CSS files you want to include. (It could still be done via template.php, really, this detail isn't super-critical.)

So if I wanted a 2-column layout with dropdown menus and flaming polkadots, my style.css would probably import 2_column_left.css, nav_dropdown_menus.css, and typography.css. At this point I've got a perfectly usable and somewhat 'custom' theme pieced together, but it's probably a bit rough around the edges. So I create my_layout.css and my_decoration.css for my own customizations, leaving the library as they are. (The starter kit could contain blank versions of these files.) Or I could skip including a pre-built decoration file and jump straight to the custom stuff. I would get a useful base to start from with no need to fuss with 'un-theming' the existing decorations in, say, the current zen-classic.

There's some semblance of this idea already in the current Zen 1.0, like with layout-fixed.css and layout-liquid.css. At the same time, we have files like zen.css that IMHO don't seem to have a real clear purpose, and files in \zen-classic that could probably be made easier to re-use. My overall goal here is to maximize the reusability of Zen's CSS, minimize the need to directly edit the built-in CSS, and make starting from scratch, even a subtheme, as unnecessary as possible. It should also enable easier user library contributions, in addition to subthemes.

At the moment, I'm not sure if I'm going to actually go forward with implementing this in Zen. I'm also considering just adapting WYMstyle into my own base theme for Drupal. Of course, if someone else were to take up this cause for Zen, it would make my decision a lot easier. :)

johnalbin’s picture

The css_library\layout\base folder is, of course, not needed since either of Zen’s layout-*.css will auto expand from 1 column to 2 or 3 column if there are blocks in its left or right sidebars.

With just a couple files per directory, it would make more sense to move those files up a level and just prefix the filename with something more descriptive. Perhaps…

style-extras/
            /layout-nav-horizontal.css <-- but don't we already have this?
            /layout-nav-dropdown.css
            /layout-grid.css <-- you're not talking yahoo grids are you?
etc.

Also, note that Drupal’s convention is to use dashes instead of underscores in filenames.

Toe’s picture

The css_library\layout\base folder is, of course, not needed since either of Zen’s layout-*.css will auto expand from 1 column to 2 or 3 column if there are blocks in its left or right sidebars.

Well, I meant a bit more than just having or not having L/R sidebars. I'd like to see some different configurations for the columns, with regard to things like size and positioning. Have a look at Layout Gala for some idea of the kind of configuration differences I mean. I'd also like to see a couple examples for more than 3 columns.

<-- but don't we already have this?

Sure, a lot of what I'm suggesting would just be breaking down and rearranging what's already there.

<-- you're not talking yahoo grids are you?

Yahoo grids, Blueprint grids, whatever grids. Maybe based on the Blueprint for Zengine work. Honestly, I've never even worked with one of these systems, I was just tossing it out as a possibility that some might like.

Also, note that Drupal’s convention is to use dashes instead of underscores in filenames.

Doesn't mean I have to like it, though. :P

Anyway, yeah, I haven't done any significant work on this. Just consider this stuff a suggestion for the future, realistically I probably won't be submitting any patches.

marcus7777’s picture

Is this good , I'd love to help. were can we start putting the folders of css togetter. I'd happily Host the folder and give you all the ftp (if needed):

* FTP Username: toesidea@happyhosting.org
* Password: hi8whp
* FTP Server: ftp.happyhosting.org
* FTP Server Port: 21

lets get this css Party Started!!

update:
I just put the folders in.

and in /zen/css_library/decoration zen_dark.css
from
http://groups.drupal.org/node/9326
and updating my grid layout:
Love it you made a more
layouts,
colour sceams,
typography,
and what ever you love to make :o)

marcus7777’s picture

Version: 5.x-1.x-dev » 6.x-1.0-beta2

updated:
see http://groups.drupal.org/node/9314

Marcus

updated 5 more files log in to see and why not upload a css or two ;o)
and added the 40 layout from http://blog.html.it/layoutgala/ and I update them to work with zen

johnalbin’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev

So, who thought this issue was dead? :-)

Actually, its been percolating in the back of my head for months and has finally turned into a tasty brew.

For small sites, a single CSS file is okay, but I've been mostly building large, complex sites and the need to organize the stylesheets into separate files is pretty apparent. Constantly scrolling up and down inside a single sitetheme.css just doesn't work.

Toe, I really appreciate getting this idea rolling. And keeping it alive. :-)

But I finally realized why I’ve been resisting your suggestions. The division of the styles seemed unnatural for Drupal theming. So, just before the holidays, I came up with a more Drupal-ish organization and did some iterations with caroltron to come up with this:

html-elements.css Zen’s reset stylesheet; standardizes HTML elements across browsers
layout.css Page layout method (DIV positioning)
wireframes.css Zen’s basic wireframing tool
backgrounds.css Background images (“Faux Columns” works well with Zen’s layout.css)
pages.css Page styling (corresponds to elements in page.tpl.php)
tabs.css Drupal’s tabs
messages.css Drupal’s error/warning/status messages
blocks.css Block styling
block-editing.css Zen’s block editing links
navigation.css Primary/secondary links or any navigation blocks
views-styles.css Views module styling
nodes.css Node styling (corresponds to elements in node.tpl.php)
comments.css Comment styling
forms.css Form styling
fields.css CCK module styling
yoroy’s picture

Just from looking at the list: the naming looks very nice, I would instantly know where to go. But would themename.css be gone completely?

Toe’s picture

So, who thought this issue was dead? :-)

Ha ha ha, me! :D

I haven't had any web design projects to work on in a while, so I'd just let this sit. But lately I've had the itch to get back into this stuff. So I decided to start up a CSS framework, targeting just straight HTML at first rather than any particular templating system. So I pulled this up to look back over my notes, and whaddayaknow? There's signs of life here!

You're right, about one thing, though. Drupal's is not the only templating system I've used (though it's probably my favorite). So I was sketching out the division in general terms that would be applicable to any web design, rather than along lines specific and natural to Drupal.

A big part of my goal with that, though, was to maximize the reusabilty of the code. I do hope, as you write & refine your code for Zen, you continue ask yourself, "How hard would it be for someone to adapt this code to a different look?"

caroltron’s picture

I think that this is the goal. You can of course add one yourself if you prefer that method, but ideally we've broken all of themename.css out into more approachable chunks. I'm actually think we might have a couple more CSS files to add for some more advanced tips - but of course that has to pass through Mr. JohnAlbin first. (sorry this was meant to be in repy to #16)

johnalbin’s picture

Title: Split up CSS files into a library format » Split up monolithic zen.css into smaller, logical stylesheets
Status: Active » Fixed
jcmarco’s picture

Good idea, it will help a lot to manage the so huge zen.css file in our sub-themes.

But as the sub-themes use to start from the STARTERKIT
and the configuration STARTERKIT.info comes with all the new css defined,

Should it not be needed to include all the new css files into this STARTERKIT Theme?

johnalbin’s picture

Status: Fixed » Postponed

Yep, yep. Definitely.

As soon as I get some good comments into the views-styles.css, I plan on making exact copies of all those CSS files and putting them in the STARTERKIT folder.

I'm marking this issue postponed until then. I'm actively working on a project that uses Views 2 extensively, so I should have something in the next couple days. patches are also, welcome. :-)

frankcarey’s picture

update? thanks!

johnalbin’s picture

Component: Code » CSS/HTML Markup
Status: Postponed » Closed (fixed)