2021-08-25 04:44:27 +03:00
|
|
|
---
|
2022-02-09 15:18:16 +03:00
|
|
|
title: Use the Redoc CLI
|
|
|
|
redirectFrom:
|
2022-05-11 00:43:23 +03:00
|
|
|
- /docs/redoc/quickstart/cli/
|
2021-08-25 04:44:27 +03:00
|
|
|
---
|
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
# How to use the Redocly CLI
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
With Redocly CLI, you can bundle your OpenAPI definition and API documentation
|
|
|
|
(made with Redoc) into a zero-dependency HTML file and render it locally.
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
## Step 1 - Install Redocly CLI
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-05-10 21:51:48 +03:00
|
|
|
First, you need to install the `@redocly/cli` package.
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-05-10 21:51:48 +03:00
|
|
|
You can install it [globally](/docs/cli/installation.md#install-globally) using npm or Yarn.
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-05-10 21:51:48 +03:00
|
|
|
Or you can install it during [runtime](/docs/cli/installation.md#use-npx-at-runtime) using npx or Docker.
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
## Step 2 - Build the HTML file
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
The Redocly CLI `build-docs` command builds Redoc into a zero-dependency HTML file.
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
To build a zero-dependency HTML file using Redocly CLI, enter the following command,
|
|
|
|
replacing `apis/openapi.yaml` with your API definition file's name and path:
|
2021-08-25 04:44:27 +03:00
|
|
|
|
|
|
|
```bash
|
2023-03-31 20:40:37 +03:00
|
|
|
redocly build-docs apis/openapi.yaml
|
2021-08-25 04:44:27 +03:00
|
|
|
```
|
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
See the [build-docs](../../cli/commands/build-docs.md) documentation for more information
|
|
|
|
on the different options and ways you can use the command.
|
2021-08-25 04:44:27 +03:00
|
|
|
|
2023-03-31 20:40:37 +03:00
|
|
|
Also, check out [Redocly CLI commands](../../cli/commands/index.md), for more
|
|
|
|
information on the different things you can do with Redocly CLI including
|
|
|
|
linting, splitting, and bundling your API definition file.
|