blog/build.sh

70 lines
1.3 KiB
Bash
Raw Normal View History

2018-12-23 06:26:25 +00:00
# Because sometimes you just have to rebuild everything
rootDir='./_site/'
2019-01-02 04:56:54 +00:00
index() {
pandoc ./markdown/index.md --css style.css -s -o $rootDir/index.html
}
2018-12-23 06:26:25 +00:00
post() {
for file in ./markdown/post/*
do
fileName=$(basename $file)
pandoc $file --css style.css -s -o $rootDir/post/${fileName%.*}.html
done
}
page() {
for file in ./markdown/pages/*
do
pandoc $file --css style.css -s -o $rootDir/page/${fileName%.*}.html
done
}
style() {
# Updating index style
cp style.css $rootDir/style.css
# Updating page style
cp style.css $rootDir/page/style.css
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/page/style.css
# Updating post style
cp style.css $rootDir/post/style.css
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/post/style.css
}
yeet() {
post
page
style
# finally we'll upload the site itself to neocities
neocities push _site/
}
2019-01-02 04:56:54 +00:00
# Setups site directory from scratch
init() {
mkdir -p "$rootDir/page/" "$rootDir/post/" "$rootDir/fonts/" "$rootDir/img/"
cp ./img/* "$rootDir/img/"
cp ./fonts/* "$rootDir/fonts/"
post
page
index
style
}
2018-12-23 06:26:25 +00:00
"$@"
2019-01-02 04:56:54 +00:00
if [ -z $1 ]
then
echo './build.sh init - create website from scratch'
echo './build.sh post - builds posts'
echo './build.sh page - builds pages'
echo './build.sh style - builds style'
echo './build.sh yeet - upload to neocties'
fi