“Reducing the movement of matter – whether goods, or people – is a main challenge in the transition to sustainability.” The other two lines are as good.
Free comics for display on the PSP. Nice.
06 July 2007
There comes a point in every developer’s life when your realise the problem isn’t your work, but the tools you’ve got to hand. Toolsmithery is an important part of the job, and so I spent a few hours yesterday crafting a tool useful to any front-end developer.
The result is the CSS Redundancy Checker.
When you’re writing HTML, over time, your CSS files begin to fill up a lot. If you’re working on a large project, you might even end up with several people contributing to the CSS file, not to mention refactoring each other’s work. The result is a directory full of HTML files, and a very large CSS file.
What tends to happen is that not ever selector in the CSS file actually applies to your HTML; many are rendered redundant by refactoring, or by changes in HTML. But when you’ve got a 70k+ CSS file, it’s not easy to check precisely which selectors aren’t in use any more.
Enter the CSS Redundancy Checker. It’s a very simple tool, really. You pass in a single css file, and either a directory of HTML files, or a .txt file listing URLs (one to a line). It then proceeds to look at each file in turn, and at the end, list all the selectors in your css file that aren’t used by any of the HTML files.
That’s it. I’m pretty sure it’s accurate, and it should work with most CSS files. Most of the magic isn’t down to me, but down to _why the lucky stiff‘s marvelous Hpricot HTML parser. The script itself is about 50 lines of reasonably tidy Ruby. You’ll need Ruby, and Hpricot, in order to run it. There’s more full documentation over at the Google Code site where I’m hosting it. Please add any issues there, or get in touch if you want to contribute.
Things it doesn’t do: listing line numbers of where the selectors are. I wrote that functionality on the train this morning, but I can’t find a way to make it 100% accurate, so thought it best to leave it out – inaccurate line numbers are of no use to anyone. If you can come up with a way that works, let me know. Also, at some point I might turn it into a Textmate command. All in good time, though.
The need for the tool came out of a large project we’re working on at NPG, but I felt it would be useful to pretty much any HTML developer. So I’ve released it to the world. Let me know what you think, and do spread the word. You can get it via svn checkout, for now:
svn checkout http://css-redundancy-checker.googlecode.com/svn/trunk/ css-redundancy-checker
“Why is the girl in the centre smiling? Her fiancé lies at death’s door after being rescued from the sea. She smiles because she saw a press cameraman and knew her picture was going in the papers.” Nice article on press photographers.
Wonderful talk from Doug Crockford. Must download.
Just beautiful. The sonnet and haiku are my favourites so far. (Inform 7 is a natural-language programming language for writing text adventures).
Some nice, insightful commentary on the relevance of Apple’s Human Interface Guidelines in 2007. Good stuff, for anyone interested in interface design.
“Any team where the biggest jerk makes all the big decisions is asshole driven development.” This, and many more gems, can be found in this Scott Berkun blogpost.
01 July 2007
A long while since my last “real” post, then. In that time a lot’s happened; most significantly, I failed to pass comment on Russell Davies’ Interesting 2007, which was pretty excellent. There’s lots of stuff scattered around the web and Russell’s on site about it. It was a delightful, gentle, eye-opening, very British day of talk, tea, and apples. So good, I stayed out eating and drinking, rather than heading to Hack Day until the next day.
What I saw of Hack Day on Sunday was pretty good. I even attempted a hack in about half an hour, which went far enough as proof of concept without really being worth showing. It was a gag-hack, basically, but fun to have the challenge.
My talk at Interesting is available on Slideshare. Not only that, it’s also available on my slightly-revamped talks page. I say “slightly” revamped, because the whole markup could do with an overhaul, really, but for now, there’s lots of Slideshare action – including slides from my ETech talk last year, previously too big to host on my pitiful hosting.
Workwise, we had the official launch of Nature Precedings, which is a place for life-scientists and life-science researchers to share pre-publication and in-progress work; something a bit like a preprint service for the life-sciences community. If you’re within the larger scientific community, you might understand why it’s reasonably significant. It generated a fair bit of buzz, and I hope it goes from strength to strength. Great to work with many colleagues from NPG on it, as well as with the team at Thoughbot.
As ever, I’ve been neglecting the blog, but I’m thinking of ways around that – less, more often, might end up being some kind of solution. Right now, I feel on the cusp of something, but I have no idea what – how big it is, what it is. I’m just pushing myself forward, hoping to find that edge at some point soon.
In the meantime: I’ll keep linking, keep taking pictures, keep writing, and keep aggregating the results of those endeavours here.