Skip to content

Slidev CLI โ€‹

@slidev/cli exposes a binary called slidev that you can use to develop, build, and export your slides.

Prerequisites โ€‹

To use the CLI, you can either install @slidev/cli globally or install it locally in your Node.js project. If you created your project with npm init slidev, the CLI is already installed locally.

WARNING

Usually npx slidev is not supported because the package name is actually @slidev/cli.

The CLI options of the commands obey the following conventions:

  • the value of the option can be passed after a space or a = character:

    Example: slidev --port 8080 is equivalent to slidev --port=8080

  • true can be omitted for boolean options:

    Example: slidev --open is equivalent to slidev --open true

INFO

If you use npm, please don't forget to add -- before the options to pass them to Slidev:

bash
npm run slidev -- --remote --port 8080 --open

slidev [entry] โ€‹

Start a local server for Slidev.

  • [entry] (string, default: slides.md): path to the markdown file containing your slides.

Options:

  • --port, -p (number, default: 3030): port number.
  • --base (string, default: /): base URL (see https://vitejs.dev/config/shared-options.html#base).
  • --open, -o (boolean, default: false): open in the browser.
  • --remote [password] (string): listen to the public host and enable remote control, if a value is passed then the presenter mode is private and only accessible by passing the given password in the URL query password parameter.
  • --bind (string, default: 0.0.0.0): specify which IP addresses the server should listen on in the remote mode.
  • --log ('error', 'warn', 'info', 'silent', default: 'warn'): Log level.
  • --force, -f (boolean, default: false): force the optimizer to ignore the cache and re-bundle.
  • --theme, -t (string): override theme.

slidev build [entry] โ€‹

Build a hostable SPA. See ๐Ÿ“– Hosting for more details.

  • [entry] (string, default: slides.md): path to the slides markdown file.

Options:

  • --out, -o (string, default: dist): output directory
  • --base (string, default: /): base URL (see https://vitejs.dev/config/shared-options.html#base)
  • --download (boolean, default: false): allow the download of the slides as a PDF inside the SPA
  • --theme, -t (string): override theme

slidev export [...entry] โ€‹

Export slides to PDF (or other format). See ๐Ÿ“– Exporting for more details.

  • [entry] (string, default: slides.md): path to the slides markdown entry.

Options:

  • --output (string, default: use exportFilename (see https://sli.dev/custom/#frontmatter-configures) or use [entry]-export): path to the output.
  • --handout (boolean, default: false): generate a companion handout PDF (notes + footer) using the configured paper size.
  • --cover (boolean, default: false): prepend global cover pages from handout-cover.vue when handouts are exported.
  • --ending (boolean, default: false): append closing pages from handout-ending.vue when handouts are exported.
  • --format ('pdf', 'png', 'pptx', 'md', default: 'pdf'): output format.
  • --timeout (number, default: 30000): timeout for rendering the print page (see https://playwright.dev/docs/api/class-page#page-goto).
  • --wait (number, default: 0): wait the specified milliseconds before capturing each slide.
  • --wait-until ('networkidle', 'load', 'domcontentloaded', 'none', default: 'networkidle'): wait for a specific Playwright event before each capture.
  • --range (string): page ranges to export (example: '1,4-5,6').
  • --dark (boolean, default: false): export as dark theme.
  • --with-clicks, -c (boolean, default: false): export pages for every click animation (see https://sli.dev/guide/animations.html#click-animation).
  • --theme, -t (string): override theme.
  • --executable-path (string): provide a custom Chromium/Chrome executable for Playwright.
  • --omit-background (boolean, default: false): remove the default browser background
  • --with-toc (boolean, default: false): generate a PDF outline when exporting to PDF.
  • --per-slide (boolean, default: false): render each slide in isolation. Useful for heavy global components.
  • --scale (number, default: 2): device scale factor for non-handout exports.

slidev format [entry] โ€‹

Format the markdown file. Note that this won't format the content of the slides, only the organization of the markdown file.

  • [entry] (string, default: slides.md): path to the slides markdown entry.

slidev theme [subcommand] โ€‹

Theme-related operations.

Subcommands:

  • eject [entry]: Eject the current theme into the local file system. See โœจ Eject Theme.
    • [entry] (string, default: slides.md): path to the slides markdown entry.
    • Options:
      • --dir (string, default: theme): the output dir.
      • --theme, -t (string): override theme.

Released under the MIT License.