mirror of
https://git.mills.io/prologic/zs
synced 2024-11-21 21:06:10 +03:00
Add sites that use zs and a collection of hooks and plugins to contrib
This commit is contained in:
parent
6b15486148
commit
1d061592f5
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -4,6 +4,7 @@
|
||||
"alecthomas",
|
||||
"chromahtml",
|
||||
"definitionlist",
|
||||
"divs",
|
||||
"errbuf",
|
||||
"Furqan",
|
||||
"goldmark",
|
||||
@ -11,6 +12,7 @@
|
||||
"newext",
|
||||
"oldext",
|
||||
"outbuf",
|
||||
"pandoc",
|
||||
"PUBDIR",
|
||||
"sabhiram",
|
||||
"sirupsen",
|
||||
|
17
README.md
17
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?
|
||||
|
19
contrib/hooks/posthook
Executable file
19
contrib/hooks/posthook
Executable file
@ -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"
|
3
contrib/hooks/prehook
Executable file
3
contrib/hooks/prehook
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exit 0
|
25
contrib/plugins/importmap
Executable file
25
contrib/plugins/importmap
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
printf "Usage: %s <path>\n" "$(basename "$0")"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
modpath="$1"
|
||||
modpath="${modpath%"/"}"
|
||||
|
||||
ext=".js"
|
||||
if [ -n "$ZS_PRODUCTION" ]; then
|
||||
ext=".min.js"
|
||||
fi
|
||||
|
||||
echo "<script type=\"importmap\">"
|
||||
{
|
||||
find "$modpath" -type f -name '*.js' | while read -r file; do
|
||||
name="${file#"$modpath"}"
|
||||
name="${name#"/"}"
|
||||
name="${name%.*}"
|
||||
echo "${name}=./${modpath}/${name}${ext}"
|
||||
done
|
||||
} | jq -Rs '{ imports: split("\n") | [.[] | capture("^(?<name>[^=]+)=(?<src>.*)$") | {(.name): .src}] | add }'
|
||||
echo "</script>"
|
12
contrib/plugins/include
Executable file
12
contrib/plugins/include
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! $# = 1 ]; then
|
||||
printf "Usage: %s <file>\n" "$(basename "$0")"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
cat "$1"
|
||||
else
|
||||
echo "error: file not found $1"
|
||||
fi
|
21
contrib/plugins/scripts
Executable file
21
contrib/plugins/scripts
Executable file
@ -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 "<script type=\"application/javascript\" src=\"/js/%s.js\"></script>\n" "$script"
|
||||
done
|
||||
|
||||
for module in $MODULES; do
|
||||
printf "<script type=\"module\" src=\"/js/modules/%s.js\"></script>\n" "$module"
|
||||
done
|
||||
|
||||
printf "<script defer type=\"module\" src=\"/js/main.js\">main();</script>\n"
|
9
contrib/plugins/styles
Executable file
9
contrib/plugins/styles
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
CSS="style triangles"
|
||||
|
||||
for css in $CSS; do
|
||||
printf "<link rel=\"stylesheet\" href=\"/css/%s.css\">\n" "$css"
|
||||
done
|
Loading…
Reference in New Issue
Block a user