-
Notifications
You must be signed in to change notification settings - Fork 6
Installing Gitbook
Getting GitBook installed and ready-to-go should only take a few minutes.
Installing GitBook is easy and straightforward. Your system just needs to meet these two requirements:
The best way to install GitBook is via NPM. At the terminal prompt, simply run the following command to install GitBook:
$ npm install gitbook-cli -g
gitbook-cli is an utility to install and use multiple versions of GitBook on the same system. It will automatically install the required version of GitBook to build a book.
Once the CLI is installed, clone the main branch for the documentation site run the commands:
$ gitbook install
$ gitbook serve
$ gitbook build
The Bandwidth docs also include a helpful makefile that bundles up various commands to streamline deployments.
default: compile
gitbook_install:
gitbook install
gitbook_build:
gitbook build
gitbook_serve:
gitbook serve
compile: gitbook_install gitbook_build
serve: gitbook_install gitbook_serveYou can invoke these commands by calling make (default is to install the plugins and then build the book).
Developing the docs locally I have found a few of the plugins (like toggle-chapters) don't play friendly with the auto-refresh with the default serve. Further, some of the docs take about 90seconds to build which can prove to be annoying when making rapid changes
alias gbs="gitbook serve --no-watch --no-live"
alias gbc="rm -rf _book && rm -rf node_modules && gitbook install"
alias gbb="gitbook build"| Command | Behavior |
|---|---|
gbs |
Serves the gitbook on localhost:4000 but doesn't auto reload on detecting file changes |
gbc |
Essentially gitbook clean It removes all the generated files from install and build and re-installs all plugins. Helpful when developing new plugins and need to blow away old install files |
gbb |
Runs the gitbook build command. I occassionally use this with http-server watching the ./_book directory to psuedo-get live refresh |