lektor build

Builds the entire project into the final artifacts.

The default behavior is to build the project into the default build output path which can be discovered with the project-info command but an alternative output folder can be provided with the --output-path option.

The default behavior is to perform a build followed by a pruning step which removes no longer referenced artifacts from the output folder. Lektor will only build the files that require rebuilding if the output folder is reused.

To enforce a clean build you have to issue a clean command first.

If the build fails the exit code will be 1 otherwise 0. This can be used by external scripts to only deploy on successful build for instance.


  • -O, --output-path PATH: The output path.
  • --watch: If this is enabled the build process goes into an automatic loop where it watches the file system for changes and rebuilds.
  • --prune / --no-prune: Controls if old artifacts should be pruned. This is the default.
  • -v, --verbose: Increases the verbosity of the logging.
  • --source-info-only: Instead of building only updates the source infos. The source info is used by the web admin panel to quickly find information about the source files (for instance jump to files).
  • -f, --build-flag TEXT: Defines an arbitrary build flag. These can be used by plugins to customize the build process. More information can be found in the documentation of affected plugins.
  • --profile: Enable build profiler.
  • --help: print this help page.