1 | zs
|
---|
2 | ==
|
---|
3 |
|
---|
4 | zs is an extremely minimal static site generator written in Go.
|
---|
5 |
|
---|
6 | It's inspired by `zas` generator, but is even more minimal.
|
---|
7 |
|
---|
8 | The name stands for 'zen static' as well as it's my initials.
|
---|
9 |
|
---|
10 | ## Features
|
---|
11 |
|
---|
12 | * Zero configuration (no configuration file needed)
|
---|
13 | * Cross-platform
|
---|
14 | * Highly extensible
|
---|
15 | * Easy to learn
|
---|
16 | * Fast
|
---|
17 |
|
---|
18 | ## Installation
|
---|
19 |
|
---|
20 | Download the binaries from Github or build it manually:
|
---|
21 |
|
---|
22 | $ go get github.com/zserge/zs
|
---|
23 |
|
---|
24 | ## Ideology
|
---|
25 |
|
---|
26 | Keep your texts in markdown format in the root directory of your blog/site.
|
---|
27 |
|
---|
28 | Keep all service files (extensions, layout pages, deployment scripts etc)
|
---|
29 | in the `.zs` subdirectory.
|
---|
30 |
|
---|
31 | Define variables in the header of the markdown files:
|
---|
32 |
|
---|
33 | title: My web site
|
---|
34 | keywords: best website, hello, world
|
---|
35 |
|
---|
36 | Markdown text goes after a *newline*
|
---|
37 |
|
---|
38 | Use placeholders for variables and plugins in your markdown or html
|
---|
39 | files, e.g. `{{ title }}`.
|
---|
40 |
|
---|
41 | Write extensions in any language you like and put them into the `.zs`
|
---|
42 | subdiretory.
|
---|
43 |
|
---|
44 | Everything the extensions prints to stdout becomes the value of the
|
---|
45 | placeholder.
|
---|
46 |
|
---|
47 | Extensions can use special environment variables, like:
|
---|
48 |
|
---|
49 | * `$ZS` - a path to the `zs` executable
|
---|
50 | * `$ZS_OUTDIR` - a path to the directory with generated files
|
---|
51 | * `$ZS_FILE` - a path to the currently processed markdown file
|
---|
52 | * `$ZS_URL` - a URL for the currently generated page
|
---|
53 |
|
---|
54 | You can also pass command line arguments, e.g: `{{ my-plugin arg1 arg2 }}`
|
---|
55 |
|
---|
56 | ## Example of RSS generation
|
---|
57 |
|
---|
58 | ## Hooks
|
---|
59 |
|
---|
60 | There are two special plugin names that are executed every time the build
|
---|
61 | happens - `pre` and `post`. You can define some global action here like compile
|
---|
62 | your LESS to CSS etc:
|
---|
63 |
|
---|
64 | # .zs/post
|
---|
65 |
|
---|
66 | #!/bin/sh
|
---|
67 | lessc < $ZS_OUTDIR/styles.less > $ZS_OUTDIR/styles.css
|
---|
68 | rm -f $ZS_OUTDIR/styles.css
|
---|
69 |
|
---|
70 | ## Command line usage
|
---|
71 |
|
---|
72 | `zs build` re-builds your site.
|
---|
73 |
|
---|
74 | `zs watch` rebuilds your site every time you modify any file.
|
---|
75 |
|
---|
76 | `zs var <filename> [var1 var2...]` prints a list of variables defined in the
|
---|
77 | header of a given markdown file, or the values of certain variables (even if
|
---|
78 | it's an empty string).
|
---|
79 |
|
---|
80 | ## License
|
---|
81 |
|
---|
82 | The software is distributed under the MIT license.
|
---|