static blog system improved

My static blog system script now launches a small web server and auto-updates on a file change. This way you've got a live preview directly in your browser.

As the inital script was written in Javascript, I wrote the rest in Javascript, too.

The whole runs on node.js and uses some fancy modules:

The whole combination is amazingly fast, the updated text nearly appears in realtime.

You can find the script here: watch.js. It's more like a quick hack and not fully tested. It may crash whenever it will, but for now it works for me :)

The small app.js is just this:

socket = new io.Socket('localhost');
socket.connect();
socket.on('message', function(data){
  data = JSON.parse(data);
  if(data.reload)
    window.location.reload();
});

So next thing: individual pages for posts, maybe templates.