Nuxt/docs/3.api/4.commands/generate.md
2024-12-18 10:29:56 +00:00

42 lines
1.5 KiB
Markdown

---
title: "nuxi generate"
description: Pre-renders every route of the application and stores the result in plain HTML files.
links:
- label: Source
icon: i-simple-icons-github
to: https://github.com/nuxt/cli/blob/main/src/commands/generate.ts
size: xs
---
<!--generate-cmd-->
```bash [Terminal]
npx nuxi generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--preset] [--dotenv] [--envName]
```
<!--/generate-cmd-->
The `generate` command pre-renders every route of your application and stores the result in plain HTML files that you can deploy on any static hosting services. The command triggers the `nuxi build` command with the `prerender` argument set to `true`
## Arguments
<!--generate-args-->
Argument | Description
--- | ---
`ROOTDIR="."` | Specifies the working directory (default: `.`)
<!--/generate-args-->
## Options
<!--generate-opts-->
Option | Default | Description
--- | --- | ---
`--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`)
`--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
`--preset` | | Nitro server preset
`--dotenv` | | Path to `.env` file to load, relative to the root directory
`--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server)
<!--/generate-opts-->
::read-more{to="/docs/getting-started/deployment#static-hosting"}
Read more about pre-rendering and static hosting.
::