Need the package fo git, make, node.js, npm and gitbook-cli.
-
Install node.js and npm package.
# Mac OSX. $ brew install node npm # Ubuntu. $ sudo apt-get install nodejs npm
-
Install n with npm.
$ sudo npm install n -g
-
Downgrade node.js to v5.12.0. (see Build error with node v6 · Issue #1)
$ n 5.12.0
-
Install gitbook-cli package.
$ sudo npm install -g gitbook-cli
-
Install necessary package with npm.
$ gitbook install
-
Check version.
$ gitbook -V CLI version: 2.3.0 GitBook version: 3.1.1
-
Install calibre for build pdf, epub and mobi.
-
Link calibre command line tool.
# Mac OSX. $ ln -s /Applications/calibre.app/Contents/MacOS/ebook-convert /usr/local/bin/
Get MyBook with git.
$ git clone https://github.com/chusiang/how-to-build-the-gitbook-with-gitbook-cli.git
-
Go to
MyBook
project.$ cd ${MyBook}
-
Build static HTML.
$ make
-
Build PDF.
$ make pdf
-
Build epub for iDevice.
$ make epub
-
Build mobi for Kindle.
$ make mobi
-
Review result at local.
$ make review
-
Clean.
$ make clean
- GitBook 中文解說 - 2.0 搶先預覽 - GitBook
- GitbookIO/gitbook-cli | GitHub
- 深入淺出 GitBook 寫作與自助出版,電子書也能多人協作 by lyhcode | CodeData
- gitbook | npm
- Convert to PDF - Need to install ebook-convert from Calibre · Issue #333 · GitbookIO/gitbook
- Ansible Role: chusiang.gitbook
- Docker Hub: chusiang/gitbook
- GitHub: chusiang/gitbook.ansible.role
- Travis CI: chusiang/gitbook.ansible.role