Deploy GitBook with Bantam CLI
Modern documentation platform from markdown
Quick start:
# Build your GitBook app
gitbook build
# Deploy it
bantam deploy _book
Quick Start
Install GitBook CLI
Install GitBook command line tools
npm install -g gitbook-cli
Build documentation
Generate static HTML from markdown
gitbook build
Deploy with Bantam
Your GitBook site is now live!
bantam deploy _book
Framework Details
GitBook Configuration
Configure GitBook with book.json:
book.json:
{
"title": "My Documentation",
"description": "Comprehensive project documentation",
"author": "Your Name",
"language": "en",
"gitbook": "3.2.3",
"structure": {
"readme": "README.md",
"summary": "SUMMARY.md"
},
"plugins": [
"search",
"lunr",
"sharing",
"fontsettings",
"theme-default",
"-highlight",
"prism",
"copy-code-button"
],
"pluginsConfig": {
"theme-default": {
"showLevel": true
},
"prism": {
"css": [
"prismjs/themes/prism-tomorrow.css"
]
}
}
}
Documentation Structure
Define your book structure in SUMMARY.md:
SUMMARY.md:
# Summary
* [Introduction](README.md)
## Getting Started
* [Installation](getting-started/installation.md)
* [Quick Start](getting-started/quick-start.md)
* [Configuration](getting-started/configuration.md)
## User Guide
* [Basic Usage](guide/basic-usage.md)
* [Advanced Features](guide/advanced-features.md)
* [Feature A](guide/advanced/feature-a.md)
* [Feature B](guide/advanced/feature-b.md)
## API Reference
* [Overview](api/README.md)
* [Methods](api/methods.md)
* [Classes](api/classes.md)
## Resources
* [FAQ](resources/faq.md)
* [Troubleshooting](resources/troubleshooting.md)
Build Output
GitBook generates a complete static site in _book
:
index.html
- Documentation homepagegitbook/
- Core assets and pluginssearch_index.json
- Search index- HTML files for each markdown page
- Navigation and search functionality
Advanced Usage
Custom Domain
Deploy directly to your own domain
bantam deploy ./dist --domain myapp.com
Permanent Deployment
Keep your site online forever (requires login)
bantam deploy ./dist --permanent
Custom Expiry
Set how long your deployment stays online
bantam deploy ./dist --expiry-days 7
Custom Subdomain
Choose your own subdomain on bantam.site
bantam deploy ./dist --subdomain my-project
CI/CD Integration
Add Bantam to your continuous deployment pipeline:
# GitHub Actions example
- name: Deploy to Bantam
run: |
npm install -g @bantamhq/cli
bantam login --token ${{ secrets.BANTAM_TOKEN }}
bantam deploy ./dist --domain myapp.com --permanent
Common Issues & Solutions
Quick fixes for deployment challenges
01.GitBook CLI installation failing?
Use Node.js 10.x for compatibility:
# Use nvm to switch Node version
nvm install 10
nvm use 10
npm install -g gitbook-cli
# Initialize GitBook
gitbook init
Note: GitBook CLI is legacy software, consider alternatives like VuePress or Docusaurus
02.Plugin installation errors?
Install plugins before building:
# Install plugins
gitbook install
# Or manually install specific plugin
npm install gitbook-plugin-search
# Clean and rebuild
rm -rf _book
gitbook build
03.Pages not appearing in sidebar?
Ensure files are listed in SUMMARY.md:
# SUMMARY.md
* [Page Title](path/to/page.md)
* [Nested Page](path/to/nested.md)
# File must exist at path/to/page.md
04.Custom styles not applying?
Add custom CSS to your book:
// book.json
{
"styles": {
"website": "styles/website.css",
"pdf": "styles/pdf.css"
}
}
// Create styles/website.css
.book-summary {
background: #f8f9fa;
}
.markdown-section h1 {
color: #2c3e50;
}
05.Search not working?
Enable search plugins in book.json:
{
"plugins": [
"search",
"lunr",
"-sharing"
],
"pluginsConfig": {
"lunr": {
"maxIndexSize": 1000000
}
}
}