terraform

Terraforming static websites

OTHER License

Stars
15

Terraform

Static site generator with live preview

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!

Wait! How can static site generator run on client-side?

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.

Local development

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

Questions?

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.

MIT-style license