build command transforms your Markdown content into a complete static website, with optional local development server and automatic rebuilding.
Basic Usage
Command Options
Output Options
Output folder for generated static files.Alias: The build process generates a complete static site with HTML, CSS, JavaScript, and assets in this directory.
-oDevelopment Server Options
Run a local HTTP server to preview your Quartz site.The server provides:
Enabling
--serve automatically enables --watch for a complete development experience.- Live preview at
http://localhost:8080 - Automatic page refresh on content changes
- Proper MIME type handling for all assets
- Smart URL redirects (e.g.,
/page→/page.html)
Port to serve your local Quartz site on.
WebSocket port for hot-reload notifications.
The WebSocket connection enables instant page updates when files change, without manual browser refresh.
Base path to serve your local server on (useful for subdirectory deployments).Your site will be available at
http://localhost:8080/docsURL override for WebSocket connection when not developing on localhost.Useful for remote development environments or cloud IDEs.
Watch Options
Watch for file changes and rebuild automatically.Monitors these file patterns:
**/*.ts- TypeScript source files**/*.tsx- React components**/*.scss- Stylesheetsquartz/cli/*.js- CLI scriptsquartz/static/**/*- Static assetspackage.json- Dependencies
Performance Options
Number of threads to use for parsing notes.
Show detailed bundle information and analysis.Displays:
- Number of files transpiled
- Bundle size in bytes
- Detailed metafile analysis
Common Options
Directory containing your Markdown content files.Alias:
-dEnable verbose logging for debugging.Alias:
-vExamples
Production Build
Build your site for production deployment:./public directory.
Development Mode
Start a local development server with hot reload:Custom Output Directory
Build to a different output folder:Watch Mode (No Server)
Rebuild on changes without starting a server:Debug Build
Get detailed information about the build process:Build Process
The build command performs these steps:Configuration Loading
Reads
quartz.config.ts to understand your site configuration, plugins, and transformers.Source Transpilation
Compiles TypeScript and SCSS files using esbuild with optimizations:
- Minifies whitespace and syntax
- Bundles dependencies
- Processes Sass/SCSS stylesheets
- Transpiles JSX/TSX components
Content Processing
Transforms Markdown files through configured plugins:
- Parses frontmatter
- Processes wikilinks
- Generates backlinks
- Applies transformers
Development Server
When using--serve, Quartz starts an HTTP server with these features:
Auto-Refresh
WebSocket-based hot reload automatically refreshes your browser when:- Content files change
- Configuration is updated
- Components are modified
- Styles are edited
Smart Routing
The development server handles URL routing intelligently:MIME Types
Proper Content-Type headers for all file types:.webp→image/webp.avif→image/avif- Standard web formats handled automatically
Output Structure
The build generates this directory structure:Performance Tips
Troubleshooting
Build Failures
If the build fails:- Check
quartz.config.tssyntax - Verify all plugins are properly configured
- Use
--verbosefor detailed error messages - Ensure content directory exists and is readable
Server Issues
Port already in use
Port already in use
Change the port:
Hot reload not working
Hot reload not working
Check if the WebSocket port is blocked:
Base path not working
Base path not working
Ensure baseDir starts with
/:Source Code Reference
The build command implementation can be found at:quartz/bootstrap-cli.mjs:35- Command definitionquartz/cli/handlers.js:235- Build handler functionquartz/cli/args.js:61- Argument definitions
Next Steps
Sync Command
Deploy your built site to GitHub
Configuration
Customize your build with quartz.config.ts