about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-01-09 00:00:31 -0600
committerCase Duckworth2023-01-09 00:00:31 -0600
commitfcf0d72058b905b4a65419dc9d5c2de90861e0e5 (patch)
tree6e7804d308ca754f5735d3ee82ce079b06b065eb
parentMove preprocess (diff)
downloadvienna-fcf0d72058b905b4a65419dc9d5c2de90861e0e5.tar.gz
vienna-fcf0d72058b905b4a65419dc9d5c2de90861e0e5.zip
Edit initialization template
-rwxr-xr-xvienna54
1 files changed, 29 insertions, 25 deletions
diff --git a/vienna b/vienna index bd63a3e..8ab01ce 100755 --- a/vienna +++ b/vienna
@@ -238,31 +238,35 @@ FEED_TEMPLATE="$FEED_TEMPLATE"
238PHTML_OPTIONS="$PHTML_OPTIONS" 238PHTML_OPTIONS="$PHTML_OPTIONS"
239 239
240# Edit this with your web server's file path 240# Edit this with your web server's file path
241WWW_ROOT= 241SERVER_ROOT=
242 242
243preview() { 243# The following functions are examples. Make sure they fit your own needs
244 export _PYTHON="$(command -v python3 || command -v python)" 244# before uncommenting them.
245 if [ -n "$_PYTHON" ]; then 245
246 pkill -x "$_PYTHON" 246# preview() {
247 "$_PYTHON" -m http.server -d "$OUTDIR" & 247# export _PYTHON="$(command -v python3 || command -v python)"
248 export _VIENNA_PID="$!" 248# export URL_ROOT=http://localhost:8000
249 find . -type f -not -path "*/$OUTDIR/*" | 249# if [ -n "$_PYTHON" ]; then
250 OUTDIR="$OUTDIR" entr -rp \ 250# pkill -x "$_PYTHON"
251 sh -c 'kill "$_VIENNA_PID" >/dev/null 2>&1; 251# "$_PYTHON" -m http.server -d "$OUTDIR" &
252 vienna && "$_PYTHON" -m http.server -d "$OUTDIR"' 252# export _VIENNA_PID="$!"
253 else 253# find . -type f -not -path "*/$OUTDIR/*" |
254 log error "\\\`python' not found." 254# OUTDIR="$OUTDIR" entr -rp \
255 _preview 255# sh -c 'kill "$_VIENNA_PID" >/dev/null 2>&1;
256 fi 256# vienna && "$_PYTHON" -m http.server -d "$OUTDIR"'
257} 257# else
258 258# log error "\\\`python' not found."
259publish() { 259# _preview
260 if [ -n "$WWW_ROOT" ]; then 260# fi
261 rsync -avzP --delete "$OUTDIR/" "$WWW_ROOT/" 261# }
262 else 262
263 _preview 263# publish() {
264 fi 264# if [ -n "$SERVER_ROOT" ]; then
265} 265# rsync -avzP --delete "$OUTDIR/" "$SERVER_ROOT/"
266# else
267# _preview
268# fi
269# }
266EOF 270EOF
267 log init "$PAGE_TEMPLATE" 271 log init "$PAGE_TEMPLATE"
268 cat >"$PAGE_TEMPLATE" <<\EOF 272 cat >"$PAGE_TEMPLATE" <<\EOF