I love static site generators. This one is different. It executes on client-side in the browser. This enables several unforeseen features.
- you get embedded editor with live preview - update your pages directly from the browser!
- you may write in Javascript or Cofeescript, or anything which compiles down to Javascript
- you may use jQuery or any other client-side library you like
- you may shoot AJAXes, consume JSON data, eat YAMLs, render markdowns, anything webs can do!
Thanks to PhantomJS, we can emulate browser on server-side. When your code regenerates a site we bake the changes back into original static files. The resulting pre-baked site still keeps the ability to be live-edited when needed.
Simply we get the best of both worlds. Plus some nice integration with GitHub as a bonus.
Prerequisities:
- ruby, rubygems, bundler
- nodejs, npm, phantomjs
- nginx
Initial setup:
git clone https://github.com/darwin/terraform
cd terraform
rake init
Setup your nginx to serve terraform folder at some local url (e.g. http://terraform.local).
Development:
rake dev
=> http://terraform.local/demo
How does this compare to Jekyll?
I see Terraform as a Jekyll post-process step. Terraform definitely needs some initial static page skeletons to bootstrap. It is up to you to divide work between Jekyll and Terraform. I plan to use Jekyll for heavy-duty page layouts and generic site features. Terraform will be used for actual page content.