RunningDocumentation 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.
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
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:
CLI flags
| Flag | Short | Description |
|---|---|---|
--clean | Delete .dist/ before building | |
--dry-run | -n | Print which files would be built without writing anything |
--verbose | Print each file path as it is processed | |
--silent | -s | Suppress all output including the stats summary |
--port | -p | Port 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:
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.--clean deletes and recreates .dist/ before building, which guarantees no stale files from previous builds are left behind:
Minification
Nue automatically minifies assets in production builds. CSS is minified inline during the render step whenevernue 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 asitemap key to site.yaml:
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.
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 therss key in site.yaml:
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
Theproduction 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:
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:
4040 by default. Use --port to choose a different port:
@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.
Build your site
Run the production build from your project root:Confirm the build succeeded and review the stats output.
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.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.Verify with preview
Before pushing to production, run Open
nue preview locally to confirm routing, feeds, and page output all look correct:http://localhost:8080 and spot-check a few pages.Build stats reference
The stats printed after every build cover the following file types:| Type | Label |
|---|---|
.md | Markdown files |
.js | JavaScript files |
.ts | TypeScript files |
.html | HTML files |
.svg | SVG files |
.css | CSS files |
.png | PNG files |
.webp | WebP files |
| Other | Misc files |
.yaml) are configuration and are never counted in the stats output. Any extension not in the list above is grouped under Misc files.