A static site generator based on shopify liquid.
You need cargo
available on your $PATH
. If you don't have Rust and Cargo you can install both with rustup
- Clone this repository
git clone [email protected]:ashwins93/pacd-rs.git
- Install with cargo
cd pacd-rs
cargo install --path .
Download release binaries from Releases for your platform.
Make sure the binary pacd
is on your $PATH
.
$ pacd help
A static site generator based on shopify liquid
Usage: pacd <COMMAND>
Commands:
build Build your site from liquid templates
pack Pack your template files into an archive
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
The build command copies files recursively from a given <SITE_DIR>
into the output-dir
. Liquid
template files are
transformed into html
files.
You can supply globals for use within the template files by passing the data-path
argument to the build command. Pacd
looks for a json
file in the given path and provides them to you as data
variable in your template files. For instance
if you had a data file that looks like this
{
"person": {
"name": "John Doe"
}
}
You can access this data using the liquid expression {{ data.person.name }}
. All standard liquid operators are supported.
Templates with file name having a pattern [my_list].liquid
are special. Pacd will look for a key my_list
inside your
json file. If that key points to an array of objects which at least has an id
attribute, then a html
file is generated
for each item in the array. The output has a name <id>.html
.
Note: Pacd assumes id
s within the array are unique. Files will get overwritten if they aren't unique.
For collection templates you have access to one extra global variable {{ page.current_index }}
which will contain the
position of the object in the array being processed. Check the example file to
see how the page
global is used.
Build your site from liquid templates
Usage: pacd build [OPTIONS] <SITE_DIR>
Arguments:
<SITE_DIR> Path to the source files
Options:
-o, --output-dir <OUTPUT_DIR> The path for output [default: ./build]
-d, --data-path <DATA_PATH> Path to the JSON data [default: ./data.json]
-w, --watch Watch for directory changes
-h, --help Print help
Pack your template files into an archive
Usage: pacd pack [OPTIONS] <TEMPLATE_DIR>
Arguments:
<TEMPLATE_DIR> Path to the source files
Options:
-o, --output-path <OUTPUT_PATH> The path for output [default: ./build.tar.gz]
-h, --help Print help
Check the examples directory for more usage instructions.
The tool is very early in development. If you need a general purpose static site generator based on liquid
, check out Cobalt