redoc/cli
2022-07-26 16:33:55 +03:00
..
__test__/build/configRedoc chore: enable cli test for build command with url (#2006) 2022-05-12 18:09:49 +03:00
.npmignore chore: fix .npmignore 2018-03-21 18:02:25 +02:00
Dockerfile doc: fix some typos (#1117) 2019-12-10 08:13:37 +02:00
index.ts chore: use latest tag for build command (#2098) 2022-07-26 16:33:55 +03:00
npm-shrinkwrap.json chore: cli-v0.13.16 (#2039) 2022-06-02 16:37:43 +03:00
package.json chore: cli-v0.13.16 (#2039) 2022-06-02 16:37:43 +03:00
README.md chore: improve deprecation message for serve command (#2096) 2022-07-25 19:10:31 +03:00
template.hbs feat(cli): add disableGoogleFont parameter to cli (#1045) 2019-09-25 18:14:21 +02:00

redoc-cli

ReDoc's Command Line Interface

Installation

You can use redoc-cli by installing the package globally, or using npx.

Usage

The two following commands are available:

  • redoc-cli serve [spec] - starts the server with spec rendered with ReDoc. 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/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.

Some examples:

  • Bundle with the main color changed to orange:
    $ redoc-cli build [spec] --options.theme.colors.primary.main=orange
  • Serve with the nativeScrollbars option set to true:
    $ redoc-cli serve [spec] --options.nativeScrollbars
  • Bundle using a custom Handlebars template (check the default template for an example):
    $ redoc-cli build [spec] -t custom.hbs
  • Bundle using a custom template and add custom templateOptions:
    $ redoc-cli build [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"

With a Redocly configuration file (more info):

  1. Go to folder with your Redocly configuration file (.redocly.yaml or redocly.yaml) and your OpenAPI definition file.
  2. Build the site using the build command (options from the Redocly configuration file will be automatically fetched):
    redoc build openapi.yaml

For more details, run redoc-cli --help.