Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nuejs/nue/llms.txt

Use this file to discover all available pages before exploring further.

Running nue build compiles every asset in your project — Markdown pages, CSS, JavaScript, images, SVG — into a self-contained .dist/ directory that you can upload to any static hosting provider. The build step handles CSS minification, JS bundling via Bun, sitemap generation, and RSS/Atom feed output, producing a fully production-ready site in a single command.

The build command

nue build
Nue reads your site.yaml, processes all source files in parallel, and writes the output to .dist/. At the end of the build, a summary prints the count of each file type along with the total build time:
Markdown files: 24
CSS files: 8
JavaScript files: 5
HTML files: 3
SVG files: 12
-----
Built in: 412ms

CLI flags

FlagShortDescription
--cleanDelete .dist/ before building
--dry-run-nPrint which files would be built without writing anything
--verbosePrint each file path as it is processed
--silent-sSuppress all output including the stats summary
--port-pPort used by the preview server

File match patterns

Pass one or more match patterns after the command to build only a subset of your files. Patterns are matched against file paths either as exact paths (prefix with ./) or as substring matches:
# Build only Markdown and CSS files
nue build .md .css

# Build a specific file by exact path
nue build ./blog/post.md

# Build all TypeScript files
nue build .ts
This is useful for incremental rebuilds during CI or when you only need to regenerate certain asset types.

Output directory

All build artifacts are written to .dist/ at your project root. The directory layout mirrors your source structure, so a page at blog/post.md becomes .dist/blog/post/index.html.
The .dist/ directory is what you deploy. It contains only static files — no server processes, no build tooling, no dependencies.
Running --clean deletes and recreates .dist/ before building, which guarantees no stale files from previous builds are left behind:
nue build --clean

Minification

Nue automatically minifies assets in production builds. CSS is minified inline during the render step whenever nue build is run (the is_prod flag is set to true by the build command). JavaScript is minified using Bun.build with minify: true. Each page’s inline script is written to a temporary file, bundled through Bun’s native bundler with all external imports left untouched, and the minified result is written to .dist/ as a .html.js file.

Sitemap generation

Enable sitemap generation by adding a sitemap key to site.yaml:
# site.yaml
site:
  origin: https://example.com

sitemap:
  enabled: true
  skip:
    - draft
    - unlisted
When sitemap.enabled is true, Nue collects every Markdown page, reads its frontmatter, and writes sitemap.xml into the root of .dist/. Pages whose frontmatter contains any field listed under skip are excluded.
site.origin must be set in site.yaml. Without it, Nue cannot construct absolute URLs for the sitemap and will warn during the build.
The generated sitemap.xml follows the standard Sitemaps 0.9 schema and includes <lastmod> dates derived from each file’s modification time.

RSS/Atom feed generation

Enable feed generation with the rss key in site.yaml:
# site.yaml
site:
  origin: https://example.com

rss:
  enabled: true
  collection: posts
  title: My Blog
  description: The latest articles from my blog

collections:
  posts:
    include: [blog/]
    sort: "date desc"
    require: [title, date]
When rss.enabled is true, Nue resolves the named collection defined in rss.collection, renders each entry as an RSS <item>, and writes feed.xml to the root of .dist/. Each item includes the page title, description (from description or desc frontmatter), publication date, and absolute URL.

Production vs. development configuration

The production key in site.yaml lets you override any meta values specifically for production builds. When nue build runs, the is_prod flag is true, and Nue merges production into meta before processing any pages:
# site.yaml
meta:
  env: development
  analytics: false

production:
  env: production
  analytics: true
In development (nue or nue serve), meta.env is "development" and meta.analytics is false. In production builds, those values are overridden so your analytics script is only injected in the deployed site.

Previewing the production build

After building, you can serve the .dist/ directory locally to verify the production output before deploying:
nue preview
This starts a static file server on port 4040 by default. Use --port to choose a different port:
nue preview --port 8080
The preview server also loads any server routes you have defined in @shared/server/, so the local preview behaves identically to your production environment.
Run nue build before nue preview. If .dist/index.html does not exist, the preview command exits with an error.

Deploying to a static host

The .dist/ directory contains only static files and can be deployed to any host that serves static sites.
1

Build your site

Run the production build from your project root:
nue build --clean
Confirm the build succeeded and review the stats output.
2

Point your host to .dist/

Configure your hosting provider to use .dist/ as the publish directory and nue build (or nue build --clean) as the build command.
[build]
  command   = "nue build --clean"
  publish   = ".dist"
3

Set environment variables (if needed)

If you use the production key in site.yaml to inject API keys or tracking IDs, make sure those values are present in your hosting provider’s environment before the build runs.
4

Verify with preview

Before pushing to production, run nue preview locally to confirm routing, feeds, and page output all look correct:
nue preview --port 8080
Open http://localhost:8080 and spot-check a few pages.
5

Deploy

Push your changes. Your hosting provider triggers the build command, compiles the site to .dist/, and publishes the output. No server process is required.
Add .dist/ to your .gitignore. The build output is reproducible from source and does not need to be committed.

Build stats reference

The stats printed after every build cover the following file types:
TypeLabel
.mdMarkdown files
.jsJavaScript files
.tsTypeScript files
.htmlHTML files
.svgSVG files
.cssCSS files
.pngPNG files
.webpWebP files
OtherMisc files
YAML files (.yaml) are configuration and are never counted in the stats output. Any extension not in the list above is grouped under Misc files.

Build docs developers (and LLMs) love