Skip to main content

doom build

Build the documentation for production. This command compiles your documentation into optimized static files ready for deployment.

Usage

doom build [root] [options]

Arguments

root
string
Root directory of the documentation. Defaults to current working directory.

Options

The build command supports all Global Options. No build-specific options are available.

Behavior

Build Process

The build command:
  1. Sets Node environment to production
  2. Loads configuration from the specified or default config file
  3. Compiles all documentation files
  4. Optimizes assets (CSS, JavaScript, images)
  5. Generates static HTML files
  6. Outputs to the configured outDir

Output Directory

By default, files are built to dist/{base}/{version}. You can override this with:
  • The outDir config option
  • The --out-dir CLI flag
  • The --base flag to change the base path

Automatic Rebuild

If the environment variable __DOOM_REBUILD__ is set to true, the build process runs twice. This is useful for ensuring all cross-references are resolved correctly.

Examples

Basic build

doom build

Build specific directory

doom build ./my-docs

Build with custom config

doom build --config ./custom-config.yaml

Build with custom output directory

doom build --out-dir build

Build for specific version

doom build --v 2.0

Build with custom base path

doom build --base /docs/

Build ignoring internal routes

doom build --ignore

Build in export mode

doom build --export
This automatically excludes apis/** routes, preparing the build for PDF export.

Build specific languages

# Include only English and Chinese
doom build --include en zh

# Exclude Russian
doom build --exclude ru
doom build --download

Build with custom redirect behavior

doom build --redirect auto
Options: auto, never, only-default-lang (default)

Output

Successful build output:
info  Building documentation...
info  Build completed in 15.3s
ready Output written to: dist/docs/latest

Output Structure

Typical build output structure:
dist/
└── {base}/
    └── {version}/
        ├── index.html
        ├── assets/
        │   ├── css/
        │   ├── js/
        │   └── images/
        ├── {lang}/
        │   └── (localized pages)
        └── (documentation pages)

Environment Variables

__DOOM_REBUILD__
string
Set to true to trigger automatic rebuild after initial build.Example:
__DOOM_REBUILD__=true doom build

Build Optimization

Production Optimizations

The build process includes:
  • Minification - JavaScript and CSS are minified
  • Tree Shaking - Unused code is removed
  • Code Splitting - Efficient bundle splitting
  • Asset Optimization - Images and fonts are optimized
  • Static Generation - Pre-rendered HTML for all routes

Performance Tips

  1. Use --ignore to exclude internal/draft routes
  2. Use --include to build only needed languages
  3. Optimize images before building
  4. Keep outDir on SSD for faster writes

Troubleshooting

Build fails with memory error

Increase Node.js memory:
NODE_OPTIONS="--max-old-space-size=4096" doom build

Build is slow

  • Remove unused files from documentation directory
  • Check for large assets that need optimization
  • Use --ignore to exclude unnecessary routes

Assets not loading

Ensure the base configuration matches your deployment path:
doom build --base /my-docs/

Next Steps

After building:
  1. Preview the build locally with doom serve
  2. Export to PDF with doom export
  3. Deploy to your hosting platform

Build docs developers (and LLMs) love