Saturday, February 14, 2009

Compact. Dynamic. CSS.

Yes, it's Valentine's day and I'm posting a blog entry. . . I do have plans later, but right now I'm a lonely SOB who has nothing better to do - so here we go!

There are two specs I'm working on: Dynamic CSS and Compact CSS. They are intended to be used together, but can also be used independently. I think they're really cool and will go a long way toward making better (read prettier) apps as well as cleaner JavaScript and CSS.

There are a few sticky points though:

  1. File naming: There are essentially three possible configurations:
    • Straight Dynamic CSS (proposed extension: .dcss)
    • Straight Compact CSS (proposed extension: .ccss)
    • Combined Dynamic-Compact CSS (proposed extensions: .dccss)
  2. Backward compatibility: This is essentially impossible as far as I know. The best we could do is create three new 'rel' attribute definitions for the link tag:
    • dynamic-stylesheet - For Dynamic CSS (possible shorthand: ds)
    • compact-stylesheet - For Compact CSS (possible shorthand: cs)
    • dynamic-compact-stylesheet - For Dynamic-Compact CSS (possible shorthand: dcs)
  3. Evangelism: As great as I think these specs may be, what really matters is adoption - and that can't happen without evangelism. How do I get the word out - and more importantly how do I get buy in, and who do I get it from?
Point one really isn't a problem itself, it's more that I see how some people might view the introduction of three new file extensions as annoying/overkill. This kind of ties into the third point: I don't think three new file types will be a big deal if people understand the benefits of these specs and see how they'll help create cleaner code.

Point two kind of links points one and three. The idea is that the new 'rel' attributes would allow browsers that don't support Compact or Dynamic CSS to simply ignore the files altogether. This means, though, that there will essentially need to be at least two (possibly four) versions of every style definition:
  1. Old school CSS
  2. Compact CSS
  3. Dynamic CSS
  4. Compact and Dynamic CSS
Maybe part of the spec could say that to use Dynamic CSS the client must first implement Compact CSS. I think I like that idea. . . That does create a dependancy relationship though. . . Hmmm. . . Another solution would be to maintain the dependancy-free relationship between Compact and Dynamic CSS and develop a tool that "compiles" any CSS format required. DCSs (Dynamic-Compact-Stylesheets) could be coded and then other formats could be generated when needed. This could be code at request time on the server, or statically when the stylesheet is coded.

The biggest and most challenging issue by far is point three: Not only do I need to get the word out, but I also need to get buy in from a major browser (probably webkit) to actually work on implementing these specs.

First, though, I guess I need to actually finish and polish the specs eh?

No comments:

Post a Comment