moved to new static site generator (again)

As you may have noticed, the site has changed its look. That’s because I made a small rewrite and it resulted in a new static site generator. It’s my another NIH product, this time it’s written in Go.

stash away

I used stash before. It was written in UNIX Shell and was really perfect for my needs. Then it became slower and slower. The reason is that it could not track the timestamps of the web pages so it regenerated every page every time. It made live editing almost impossible and in general I didn’t trust it anymore (would you trust a pocket monster made of awk/sed/sh?)

So I checked the variety of the modern website generators. I used to like Python and Node, but I tried a Python generator years ago (poole) and I find Node to be somewhat slow. Yes, it’s a very subjective sentiment.

I wanted to find something fresh and experimental. I looked at Hugo and I didn’t share the whole euphoria around it. It turns out it can’t make a simple web site where index page is also a markdown content, not just a list of recent blog posts.

Then I found a brilliant zas. I so much liked the idea of “everything can be a plugin” that I wanted to see if I can make it even smaller and cleaner.

zs

That’s how I made zs. The name can be interpreted as a stripped down “zas” or as “zen static” or as my initials.

It has no configuration files. It’s absolutely flexible - you can write any plugin you want in any programming language.

Where’s the catch? Well, it means you have to write every plugin you need because zs is very very basic.

Your site will be written in Markdown, and you can define arbitrary variables in the header of the markdown page:

title: my page
foo: bar

Here goes text

Inside your markdown text you can use templates that are filled in with variable names or with the content generated by the plugins. And a plugin can be any app that can print text to stdout:

// markdown
name: John Doe

Hello, {name}. The weather is {weather}

// .zs/weaher plugin
#!/bin/sh
# TODO fetch and print some real weather information here
echo "sunny and hot"

Here name will be replaced with “John Doe” and weather with “sunny and hot”. This open ways to many helpful tricks, like RSS or table of contents generation.

Zs also supports some special hook plugins - pre and post. They can be used to compile LESS into CSS or to minify images.

Finally, zs can watch and rebuild only the modified files which finally brings me a way to quickly edit and review my pages.

So I find my exercise in minimalism to be successful (1 file, 260 LOC, 1 dependency) and you are welcome to try zs and to report the issues

Posted on 2014-12-20

like   tweet   +1
rss   @me   </>me