From 1d061592f5c6a7038551a7ba41401d7bb82e9473 Mon Sep 17 00:00:00 2001 From: James Mills <1290234+prologic@users.noreply.github.com> Date: Tue, 28 Mar 2023 00:26:11 +1000 Subject: [PATCH] Add sites that use zs and a collection of hooks and plugins to contrib --- .vscode/settings.json | 2 ++ README.md | 17 ++++++++++++++++- contrib/hooks/posthook | 19 +++++++++++++++++++ contrib/hooks/prehook | 3 +++ contrib/plugins/importmap | 25 +++++++++++++++++++++++++ contrib/plugins/include | 12 ++++++++++++ contrib/plugins/scripts | 21 +++++++++++++++++++++ contrib/plugins/styles | 9 +++++++++ 8 files changed, 107 insertions(+), 1 deletion(-) create mode 100755 contrib/hooks/posthook create mode 100755 contrib/hooks/prehook create mode 100755 contrib/plugins/importmap create mode 100755 contrib/plugins/include create mode 100755 contrib/plugins/scripts create mode 100755 contrib/plugins/styles diff --git a/.vscode/settings.json b/.vscode/settings.json index 94d2725..bf10f16 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,7 @@ "alecthomas", "chromahtml", "definitionlist", + "divs", "errbuf", "Furqan", "goldmark", @@ -11,6 +12,7 @@ "newext", "oldext", "outbuf", + "pandoc", "PUBDIR", "sabhiram", "sirupsen", diff --git a/README.md b/README.md index 111873c..505d56a 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ EOF zs serve ``` -For a starter template see the [zs-starter-tempate](https://git.mills.io/prologic/zs-stater-template) which can also be found running live at [zs.mills.io](https://zs.mills.io). +For a starter template see the [zs-starter-template](https://git.mills.io/prologic/zs-stater-template) which can also be found running live at [zs.mills.io](https://zs.mills.io). ## Features @@ -215,6 +215,8 @@ for f in ./blog/*.md ; do done | sort -r -n | cut -d' ' -f2- ``` +Looking for more plugins? Check out the [contrib/plugins](https://git.mills.io/prologic/zs/src/branch/main/contrib/plugins) collection! + ## Hooks There are two special plugin names that are executed every time the build @@ -234,6 +236,8 @@ 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" ``` +Looking for more hooks? Check out the [contrib/hooks](https://git.mills.io/prologic/zs/src/branch/main/contrib/hooks) collection! + ## Command line usage - `zs build` re-builds your site. @@ -282,6 +286,17 @@ Flags: Use "zs [command] --help" for more information about a command. ``` +## Who's using zs? + +Here's a few sites that use `zs` today: + +- https://yarn.social -- Landing page of the decentralized microBlogging ecosystem. +- https://salty.im -- Landing page of the e2e encrypted IndieWeb inspired messaging protocol. +- https://zs.mills.io -- zs starter template demo. +- https://prologic.shortcircuit.net.au -- Home page of James Mills / prologic (author of zs) + +Want to add your site here? File an issue or submit a pull-request! + ## Frequently Asked Questions ### How do I link to other pages? diff --git a/contrib/hooks/posthook b/contrib/hooks/posthook new file mode 100755 index 0000000..fd56793 --- /dev/null +++ b/contrib/hooks/posthook @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +minify_assets() { + p="$1" + t="$2" + + find "$p" -type f -name "*.$t" | while read -r file; do + name="${file#"$p"}" + name="${name#"/"}" + #name="${name%.*}" + #minify -o "${p}/${name}.min.$t" "$file" + minify -o "${p}/${name}" "$file" + done +} + +minify_assets "$ZS_OUTDIR" "css" +minify_assets "$ZS_OUTDIR" "js" diff --git a/contrib/hooks/prehook b/contrib/hooks/prehook new file mode 100755 index 0000000..c52d3c2 --- /dev/null +++ b/contrib/hooks/prehook @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 diff --git a/contrib/plugins/importmap b/contrib/plugins/importmap new file mode 100755 index 0000000..9deee6b --- /dev/null +++ b/contrib/plugins/importmap @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + printf "Usage: %s \n" "$(basename "$0")" + exit 1 +fi + +modpath="$1" +modpath="${modpath%"/"}" + +ext=".js" +if [ -n "$ZS_PRODUCTION" ]; then + ext=".min.js" +fi + +echo "" diff --git a/contrib/plugins/include b/contrib/plugins/include new file mode 100755 index 0000000..3fd99f4 --- /dev/null +++ b/contrib/plugins/include @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ ! $# = 1 ]; then + printf "Usage: %s \n" "$(basename "$0")" + exit 0 +fi + +if [ -f "$1" ]; then + cat "$1" +else + echo "error: file not found $1" +fi diff --git a/contrib/plugins/scripts b/contrib/plugins/scripts new file mode 100755 index 0000000..17eeaec --- /dev/null +++ b/contrib/plugins/scripts @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +SCRIPTS="page" +MODULES="globe phenon" + +# Load live.js for non-production builds for faster development +if [ -z "$ZS_PRODUCTION" ]; then + SCRIPTS="$SCRIPTS live" +fi + +for script in $SCRIPTS; do + printf "\n" "$script" +done + +for module in $MODULES; do + printf "\n" "$module" +done + +printf "\n" diff --git a/contrib/plugins/styles b/contrib/plugins/styles new file mode 100755 index 0000000..899ba6f --- /dev/null +++ b/contrib/plugins/styles @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +CSS="style triangles" + +for css in $CSS; do + printf "\n" "$css" +done