The build command transforms your Markdown content into a static HTML website. It processes your files through the configured plugins and outputs the final site to a directory of your choice.

Flags

FlagShorthandDescriptionDefault
--directory-dThe directory containing your Quartz projectCurrent directory
--verbose-vEnable detailed logging for debuggingfalse
--output-oThe directory where the built site will be savedpublic
--serveStart a local development serverfalse
--watchRebuild the site when files changefalse
--portThe port for the development server8080
--wsPortThe port for the WebSocket hot-reload server3001
--baseDirSet a base directory for the site (e.g. for GitHub Pages)/
--remoteDevHostThe hostname to use for the development serverlocalhost
--bundleInfoOutput a JSON file with bundle size informationfalse
--concurrencyNumber of worker threads to use for buildingCPU core count

Examples

Basic Build

Generate your site into the public folder.

npx quartz build

Development Mode

Start a local server and watch for changes. This is the most common way to preview your site while writing.

npx quartz build --serve

Custom Output and Port

Build to a specific folder and run the server on a different port.

npx quartz build --serve --output dist --port 3000

Performance Tuning

If you have a very large vault, you can limit the number of concurrent workers to save memory.

npx quartz build --concurrency 2

Development Server

The --serve flag starts a local web server. This server is intended for development and previewing only. It is not designed for production use. For information on how to deploy your site, see hosting.

Hot Reloading

When running with --serve, Quartz automatically enables --watch. It uses a WebSocket connection (on the port specified by --wsPort) to notify your browser when a file has changed. The browser will then automatically refresh to show the latest version of your content.