# zs - Zen Static site generator zs is an extremely minimal static site generator written in Go. [![Build Status](https://ci.mills.io/api/badges/prologic/zs/status.svg)](https://ci.mills.io/prologic/zs) ## Quick Start ```console go get install go.mills.io/zs@latest cat > .zs/layout.html < {{ title }} {{ content }} EOF cat > index.md <\n" "$(basename "$0")" exit 0 fi if [ -f "$1" ]; then cat "$1" else echo "error: file not found $1" fi ``` ### Extension: RSS `.zs/rss`: ```bash #!/bin/sh for f in ./blog/*.md ; do d="$("$ZS" var "$f" date)" if [ ! -z $d ] ; then timestamp="$(date --date "$d" +%s)" url="$("$ZS" var "$f" url)" title="$("$ZS" var "$f" title | tr A-Z a-z)" desc="$("$ZS" var "$f" description)" echo $timestamp \ "" \ "$title" \ "http://zserge.com/$url" \ "$desc" \ "$(date --date @$timestamp -R)" \ "http://zserge.com/$url" \ "" fi done | sort -r -n | cut -d' ' -f2- ``` ## Hooks There are two special plugin names that are executed every time the build happens: - `prehook` -- executed before the build - `posthook` -- executed after the build You can use these to customize the build before and after. For example you can use the `posthook` to minify CSS or Javascript files. `.zs/posthook`: ```bash #!/bin/sh set -e minify -o "$ZS_OUTDIR/css/fa.min.css" "$ZS_OUTDIR/css/fa.css" minify -o "$ZS_OUTDIR/css/site.min.css" "$ZS_OUTDIR/css/site.css" rm -rf "$ZS_OUTDIR/css/fa.css" rm -rf "$ZS_OUTDIR/css/screen.css" ``` ## Command line usage - `zs build` re-builds your site. - `zs build ` re-builds one file and prints resulting content to stdout. - `zs watch` rebuilds your site every time you modify any file. - `zs serve` rebuilds your site and serve it on the network. - `zs var [var1 var2...]` prints a list of variables defined in the header of a given markdown file, or the values of certain variables (even if it's an empty string). ## License `zs` is licensed under the terms of the [MIT License](/LICENSE) and was orignally forked from [zserge/zs](https://github.com/zserge/zs) also licensed under the terms of the [MIT License](/LICENSE.old).