-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (25 loc) · 876 Bytes
/
Makefile
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
29
30
31
32
build: $(patsubst content/%,build/%,$(shell find content -type f))
clean:
rm -fr build
build/%.html: content/%.html resources/header.html resources/footer.html Makefile
@mkdir -p $(dir $@)
sed -E 's|(href="$(subst content/,,$<))|class="youarehere" \1|' resources/header.html | cat - $< resources/footer.html > $@
cp -rf assets/* build
build/%: content/%
cp $< $@
# Deploy to gh-pages branch according to
# https://sangsoonam.github.io/2019/02/08/using-git-worktree-to-deploy-github-pages.html
deploy:
git worktree add deploy gh-pages
cp -rf build/* deploy
cd deploy && \
git add --all && \
git commit -m "Deploy to GitHub Pages" && \
git push origin gh-pages
git worktree remove deploy
# Automatic rebuilds:
watch:
find content resources/header.html resources/footer.html Makefile | entr make
# Local webserver
serve:
python -m http.server -d build