Just thought to mention I published an article over at JSter.net under topic "Learn to Develop Static Site Generators". In it I'll go through setting up a project in Node.js and then show a couple of tricks to get started in writing small utilities like this. There are certain challenges but you can get around those with some nice library choices.
I wrote the article originally for Software Developer's Journal magazine around August. After three(!) different editors they finally managed to get the thing out in their December issue. About time! If they ask you to write anything, be very wary. I don't entirely agree with their business practices or the way of dealing with this sort of work. It seems somewhat sketchy to me.