Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An ebook epub build script using mostly Pandoc. I use this one to build "Game Construction Kit: Underwater Tomato Ninja".
# build-epub.sh (in epub)
# prep the output directories
mkdir ./_epub/illustrations/
mkdir ./_epub/audio/
# copy assets to the epub structure
rsync --verbose --update --recursive --progress --times ./illustrations/ ./_epub/illustrations/
rsync --verbose --update --recursive --progress --times ./audio/ ./_epub/audio/
cp "epub.css" "./_epub/epub.css"
# copy the chapter files into the book folder structure
cp "01-chapter1.md" "./_epub/01-introduction/01-chapter1.md"
cp "01-chapter2.md" "./_epub/02-instructions-and-setup/01-chapter2.md"
cp "01-chapter3.md" "./_epub/03-play-and-question-the-game/01-chapter3.md"
cp "01-chapter4.md" "./_epub/04-code-is-communication/01-chapter4.md"
cp "01-chapter5.md" "./_epub/05-introduction-to-game-design/01-chapter5.md"
cp "01-chapter6.md" "./_epub/06-inside-the-game-engine/01-chapter6.md"
cp "01-chapter7.md" "./_epub/07-creating-art--sound--and-text-for-a-game/01-chapter7.md"
cp "01-chapter8.md" "./_epub/08-the-game-engine/01-chapter8.md"
cp "01-chapter9.md" "./_epub/09-advanced-animation/01-chapter9.md"
cp "01-chapter10.md" "./_epub/10-reflecting-on-what-we-ve-learned/01-chapter10.md"
cp "01-chapter11.md" "./_epub/11-appendices/01-chapter11.md"
cd _epub
# build the book in pandoc
pandoc -S --epub-cover-image=illustrations/gck-utn-cover-01.png -o gck-utn-book.epub --epub-stylesheet=epub.css --epub-metadata=metadata.xml -o gck-utn-book.epub title.txt \
"01-introduction/01-chapter1.md" \
"02-instructions-and-setup/01-chapter2.md" \
"03-play-and-question-the-game/01-chapter3.md" \
"04-code-is-communication/01-chapter4.md" \
"05-introduction-to-game-design/01-chapter5.md" \
"06-inside-the-game-engine/01-chapter6.md" \
"07-creating-art--sound--and-text-for-a-game/01-chapter7.md" \
"08-the-game-engine/01-chapter8.md" \
"09-advanced-animation/01-chapter9.md" \
"10-reflecting-on-what-we-ve-learned/01-chapter10.md" \
"11-appendices/01-chapter11.md"
# open the book to test and preview
open /Applications/Sigil.app ./gck-utn-book.epub
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.