Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Hugo build script for User page] #github #hugo #build
#!/usr/bin/env bash
function contains {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
function remove_toplevel {
local blacklist=(build.sh CNAME keybase.txt src)
local trigger=0
for i in *; do
if contains "$i" "${blacklist[@]}"; then
trigger=1
echo "this is a blacklist file: $i"
else
rm -rf "$i"
fi
done
if [[ $trigger -eq 1 ]]; then
printf "\n...we won't delete these files.\n\n"
fi
}
function build_site {
pushd "./src" 1>/dev/null
hugo
cp -r ./public/ ../
popd 1>/dev/null
}
remove_toplevel
build_site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.