aboutsummaryrefslogtreecommitdiffstats
path: root/bin/ssg
blob: f8da7c6223b277a4d8b4508a624f576d9122c2a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

. bin/func

set -xe

media_branch="media"
src_files="$(__list_files ${src_dir})"
dirs="${media_dir} \
	${src_dir} \
	${tmp_dir} \
	${out_dir}"

# Ensure directories exist.
for dir in ${dirs}; do
	[ ! -d "${dir}" ] && mkdir "${dir}"
done

# Generate output files from sources.
for src_file in ${src_files}; do
	__handle "${src_file}"
done

# Copy images
if git rev-parse media; then
	git restore --source=media --worktree "img"
	mv "img" "out"
fi
remember that computers suck.