A simple template to help you create ePub-formatted books.
HTML Shell CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
book
.gitignore
LICENSE
README.md
check
publish

README.md

ePub Boilerplate

A simple template that helps you build ePub-formatted books.

How to use the template

  1. Clone the repo:

     $ git clone git@github.com:javierarce/epub-boilerplate.git
    
  2. Edit the contents of the book directory1.

  3. Run the publish script to generate and validate the book:

     $ ./publish book
    

1: You'll find comments inside several files to guide you.

Structure of a book

Here's the structure of the sample book included in the repo:

▾ book/
  ▾ META-INF/
      com.apple.ibooks.display-options.xml
      container.xml
  ▾ OEBPS/
    ▾ Images/
        cover.jpg
        image-01.jpg
        image-02.png
    ▾ Styles/
        style.css
    ▾ Text/
        acknowledgements.xhtml
        chapter01.xhtml
        chapter02.xhtml
        chapter03.xhtml
        cover.xhtml
        dedication.xhtml
        endnotes.xhtml
        foreword.xhtml
        frontmatter.xhtml
        introduction.xhtml
        toc.xhtml
      content.opf
      toc.ncx
    mimetype

ePub validation

This project uses epubcheck to validate the generated ePubs. If the build.sh script complains when running epubcheck, make sure you have java installed and it's in your PATH.

If you need help running epubcheck read this step-by-step guide.

How to check your ebook

It's super easy. Just do:

$ ./check book.epub

This project currently uses EpubCheck version 4.0.

Style

Caveat lector: currently there aren't any defined styles. While I add a basic layout have a look at the ePub CSS Starter Kit.

ePub → mobi

If you want to transform your .epub file to .mobi do this:

  1. Download KindleGen.
  2. Uncompress the file.
  3. Copy the kindlegen executable to the bin folder.
  4. Run ./bin/kindlegen book.epub.

Useful resources

EPUB 3

Metadata

Styling

Validation

Compatibility and rendering issues