If only I'd waited

Posted in: Programming

One of the new things I started using as part of this latest site redesign is a CSS framework called LessCSS. It's pretty handy in that it lets you write more concise CSS code that closely mimics the actual structure of your page, and I've found that it leads to much shorter CSS files. Well, when using LessCSS you're actually writing 'LESS' files instead of CSS files, but since LESS files are written using existing CSS conventions, the difference is minimal and the learning curve is ridiculously low.

The standard implementation of LessCSS is as a JavaScript file that parses a LESS file, turning it into a CSS file, all on the user's browser. There are pros/cons of post-processing a page on the user's machine, and I took some issue with a) the fact that it relies on the user having JavaScript, and b) created a noticeable FOUC (Flash Of Unstyled Content) on development versions of my site. (I can't put blame solely on LessCSS for the FOUC however. I was already incurring a bit of 'FOUC debt' with my reliance on additional resources like Google Web Fonts and Prefix free, so LessCSS was just making that situation worse.)

The LessCSS page does show some ways to run it on the server, but it was done using node.js, which I don't use. So I searched for whether someone else had already created a Java version of LessCSS that I could use/adapt, and of the handful that existed, they were either too old, too broken, too limited in how to use them, or too dependant on other stuff that I didn't want to bring into my server.

So, I wrote my own.

Fast-forward to now. I've got a working LessCSS filter/processor to work through the CSS requests on the server using Mozilla Rhino and Envjs, it's got some basic caching and other checks to save on processing (saves roughly 500ms on duplicate CSS file requests), and I was really proud of what I had put together.

Pride of lions
Pride: it cometh before the fall

Now that the redesign is complete, I wanted to share the LessCSS filter/processor code (I've got this and a few other projects I want to put online), so this morning I created a GitHub account, then thought, Hey, let's Google those other LessCSS projects to see if they've made any progress. What I found was that, in the 2 months that it took for me to do the website redesign, SOMEONE HAD WRITTEN AND UPLOADED A NEW LESSCSS PROCESSOR THAT DOES EXACTLY WHAT MINE DOES.

Autumn/Fall
The Fall: it cometh after pride

*deep breath*

Even though someone has already beaten me to the punch, I'll continue to work on my LessCSS filter/processor and upload it eventually (I've got that and a bunch of other projects I've been meaning to put online). It'll be my first project on GitHub, and my first real foray into online code contribution. Still, it's not helping to silence the part of me that wishes that guy's LessCSS processor project was uploaded, oh, about 2 and a half months ago! (Could've saved me about a week's worth of work dammit!)