Scanty, the Blog That's Almost Nothing

scanty blogs

Tue Nov 04 16:00:42 -0800 2008

Rolling your own blogging software is the way to go for hackers, so I’ve ported this blog from SimpleLog to my own custom creation. 4 hours of work and 200 lines of Ruby code = a blog that does everything I need and no more. I call it Scanty.

Appearances by many familiar faces: Sinatra for the web framework, Sequel for the ORM, RDiscount for the markdown, and Syntax for the code highlighting. I’ve punted on comments via Disqus, snatched some CSS from freecsstemplates.org, and nabbed a template for the Atom feed from Wink. Export/import of my posts via YAML file took a grand total of 8 lines of code.

Grab the sourcecode, you could use it as a base for your own custom blog.

Since I’ve got a little fetish for small line counts these days, I ran some stats on popular Ruby blogs:

Typo89,230
Mephisto15,747
Feather7,332
Wink6,930
Scanty657

(Includes ruby source, erb/haml/builder templates, CSS, and javascript. Does not include tests, specs, or vendored plugins/gems. Not apples-to-apples at all, but I note that Wordpress is around 60k lines by a similar measure.)

I figured Scanty would be smaller, but an order of magnitude smaller than any off-the-shelf package, including Feather which bills itself as “ultralightweight”? And two orders of magnitude smaller than the largest one? Hot damn.

This isn’t a blogging engine, just a blog. So the LoC comparison isn’t very fair. (Typo spends 5k lines of code on internationalization, for example.) But what’s the point of a blogging engine? We’re programmers, right? If you want to change the theme, edit the CSS. If you want to change the interface text, edit the views. If you want to change the functionality, edit the Ruby.

It helps that I used Sinatra (of course) and Sequel (rapidly becoming my favorite ORM). Both packages set a powerful example for minimalist software. Like Yoda lifting an X-Wing out of the swamp with only the strength of his furrowed brow, writing a useful piece of software with only the barest quantity of code is a liberating and empowering experience.