Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 72 lines (56 sloc) 1.89 KB
#!/bin/bash
printf "\n💯 build\n"
PANDOC_PARAMS="--atx-headers --template=templates/html.template --from markdown --to=html5 -H head.html -B header.html --metadata-file=index.yml"
DIST=dist
printf "\n⛏ index page"
mkdir -p $DIST
rm -rf $DIST/*
pandoc $PANDOC_PARAMS index.md -o $DIST/index.html
printf "\n⛏ about page"
mkdir -p $DIST/about
pandoc $PANDOC_PARAMS about.md -o $DIST/about.html
cp $DIST/about.html $DIST/about/index.html
printf "\n⛏ pocket page"
mkdir -p $DIST/pocket
pandoc $PANDOC_PARAMS pocket.md -o $DIST/pocket.html
cp $DIST/pocket.html $DIST/pocket/index.html
printf "\n⛏ copying assets"
cp -r assets dist/
printf "\n⛏ copying styles\n"
cp -r main.css dist/main.css
cp -r carbonads.css dist/carbonads.css
cp github-contributions.svg dist/github-contributions.svg
printf "\n⛏ copying scripts\n"
cp -r main.js dist/main.js
printf "\n⛏ copying synced.json\n"
cp synced.json dist/synced.json
printf "\n⛏ copying github-contributions.svg\n"
cp github-contributions.svg dist/github-contributions.svg
printf "\n⛏ building index.yml\n"
echo "posts: " > index.yml
for file in $(ls -lr posts/*.md)
do
if [ -f $file ] && [ "$file" != "posts/index.md" ]; then
filepath=$(basename ${file%.*})
date=${filepath:0:10}
title=${filepath:11:100}
echo " - date: $date" >> index.yml
echo " title: \"$title\"" >> index.yml
echo " filepath: \"$filepath\"" >> index.yml
fi
done
mkdir -p $DIST/posts
printf "\n⛏ building posts\n"
pandoc $PANDOC_PARAMS posts/index.md -o $DIST/posts/index.html
cp $DIST/posts/index.html $DIST/posts/index.html
for file in posts/*.md
do
if [ -f $file ] && [ "$file" != "posts/index.md" ]; then
name=$(basename ${file%.*})
# echo "⛏ $name"
printf "."
pandoc $PANDOC_PARAMS posts/$name.md -o $DIST/posts/$name.html
mkdir -p $DIST/posts/$name
cp $DIST/posts/$name.html $DIST/posts/$name/index.html
fi
done