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.

The nue CLI is the single entry point for every project task in Nue. You start the development server, build for production, preview the output, and scaffold new projects — all from the same command. Flags and file-match patterns let you narrow what gets built and how output is reported.

Syntax

nue [command] [options] [file_matches]
nue -v | --version
nue -h | --help
file_matches are extension or filename fragments passed after the command. They tell the build step to process only files whose names contain those strings. Both patterns may appear together:
# Build only Markdown and CSS files
nue build .md .css

# Build only a specific template
nue build blog.html

Commands

serve / dev

Start the development server with live-reload. serve and dev are aliases for the same command. Running nue with no command also defaults to serve mode.

build

Build a production-ready site into the .dist directory. Sets is_prod = true, which activates the production configuration block.

preview

Serve the already-built .dist directory so you can verify the production output before deploying.

create

Scaffold a new project from a starter template. Accepts a template name and an optional target directory.

serve / dev

Starts a local development server from the current directory. Any change to a source file triggers an incremental rebuild and a hot-reload signal to all connected browsers.
nue
nue serve
nue dev
nue serve --port 3000
serve requires a site.yaml file or an index.md / index.html in the working directory. If neither is found, Nue exits with Not a Nue directory.

build

Compiles all sources into .dist. The is_prod flag is set to true, which causes the production block inside site.yaml to be merged into meta.
nue build
nue build --clean
nue build --dry-run
nue build .ts .css          # only TypeScript and CSS files
nue build --verbose

preview

Serves .dist on a local HTTP server so you can inspect the production output:
nue preview
nue preview --port 8080

create

Scaffolds a new project. The first positional argument is the template name; the second optional argument sets the output directory.
nue create blog
nue create blog my-project

Flags

Global flags

-h, --help
boolean
Print the usage message and exit. No other work is performed.
-v, --version
boolean
Print the Nue version and the Bun runtime version, then exit.
-s, --silent
boolean
Suppress all output messages. Useful in CI pipelines where you want to check only the exit code.
--verbose
boolean
Emit detailed per-file progress information during a build or serve run.

Server flags

-p PORT, --port PORT
number
Override the port used by serve or preview. The value is read from the next positional argument after the flag.
nue serve --port 4000
nue preview -p 8080

Build flags

-n, --dry-run
boolean
Print a list of files that would be built without actually writing anything to disk. Useful for verifying which files a match pattern selects.
nue build --dry-run .ts
-i, --init
boolean
Rebuild the Nue runtime files inside .dist/@nue. You rarely need this; it runs automatically as part of a normal build.
--clean
boolean
Delete the entire .dist directory before building. Use this when you want a guaranteed clean output with no stale artifacts.
nue build --clean

File match patterns

Any positional arguments that appear after the command and flags are treated as file-match strings. The build step skips every file whose path does not contain at least one of the patterns.
# Rebuild only Markdown and CSS
nue build .md .css

# Rebuild only files in the blog directory
nue build blog/

# Rebuild a single file by partial name
nue build contact.html
File match patterns accept any substring, not just extensions. You can pass a directory path segment, a filename, or a partial path to target a narrow set of files.

Argument parsing details

Nue’s argument parser (getArgs) expands combined short flags before processing. -np expands to -n -p, so compact flag clusters work as expected:
nue build -ns          # equivalent to: nue build -n -s
The parser reads commands from a fixed list (serve, dev, build, preview, create, push). The first token that matches this list sets the command; everything else is a flag or file-match pattern.

Exit behavior

SituationExit
--help printed0 (clean)
--version printed0 (clean)
Not a Nue directoryLogs error, exits
Unknown flagThrows Unknown option: "…"
--port flag with no valueThrows port not set

Examples

# Start development server on the default port
nue

# Build everything and wipe stale output first
nue build --clean

# Build only Markdown files with verbose logging
nue build .md --verbose

# Preview the production build on a custom port
nue preview --port 9000

# Dry-run: see which TypeScript files would rebuild
nue build --dry-run .ts

# Scaffold a new project from the blog template
nue create blog my-site

Build docs developers (and LLMs) love