2018-03-18 18:55:53 +03:00
|
|
|
# redoc-cli
|
|
|
|
|
2019-06-04 15:47:22 +03:00
|
|
|
**[ReDoc](https://github.com/Redocly/redoc)'s Command Line Interface**
|
2018-03-18 18:55:53 +03:00
|
|
|
|
|
|
|
## Installation
|
2021-07-09 10:25:52 +03:00
|
|
|
|
|
|
|
You can use `redoc-cli` by installing [the package](https://www.npmjs.com/package/redoc-cli) globally,
|
|
|
|
or using [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b).
|
2018-03-18 18:55:53 +03:00
|
|
|
|
|
|
|
## Usage
|
2018-03-20 12:39:53 +03:00
|
|
|
|
2021-07-09 10:25:52 +03:00
|
|
|
The two following commands are available:
|
2018-03-20 12:39:53 +03:00
|
|
|
|
2021-07-09 10:25:52 +03:00
|
|
|
- `redoc-cli serve [spec]` - starts the server with `spec` rendered with ReDoc.
|
2022-03-30 15:17:45 +03:00
|
|
|
Supports a server-side rendering mode (`--ssr`)
|
|
|
|
and can watch the spec (`--watch`) to automatically reload the page whenever it changes.\
|
|
|
|
Deprecated. Use `npx @redocly/openapi-cli preview-docs [spec]`
|
|
|
|
- `redoc-cli bundle [spec]` - bundles `spec` and Redoc into a **zero-dependency** HTML file.\
|
|
|
|
Deprecated. Use Use "build" command instead.
|
|
|
|
- `redoc-cli build [spec]` - build `spec` and Redoc into a **zero-dependency** HTML file.
|
2018-03-20 12:39:53 +03:00
|
|
|
|
|
|
|
Some examples:
|
|
|
|
|
2021-07-09 10:25:52 +03:00
|
|
|
- Bundle with the main color changed to `orange`:<br/>
|
2022-03-30 15:17:45 +03:00
|
|
|
`$ redoc-cli build [spec] --options.theme.colors.primary.main=orange`
|
2021-07-09 10:25:52 +03:00
|
|
|
- Serve with the `nativeScrollbars` option set to true:<br/>
|
|
|
|
`$ redoc-cli serve [spec] --options.nativeScrollbars`
|
|
|
|
- Bundle using a custom [Handlebars](https://handlebarsjs.com/) template
|
|
|
|
(check the [default template](https://github.com/Redocly/redoc/blob/master/cli/template.hbs) for an example):<br/>
|
2022-03-30 15:17:45 +03:00
|
|
|
`$ redoc-cli build [spec] -t custom.hbs`
|
2021-07-09 10:25:52 +03:00
|
|
|
- Bundle using a custom template and add custom `templateOptions`:<br/>
|
2022-03-30 15:17:45 +03:00
|
|
|
`$ redoc-cli build [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"`
|
2021-07-09 10:25:52 +03:00
|
|
|
|
|
|
|
For more details, run `redoc-cli --help`.
|