Skip to content
Permalink
next
Go to file
1 contributor

Users who have contributed to this file

92 lines (68 sloc) 2.37 KB

Standalone Mode

Storybook can be run standalone from Node, although it should be noted this isn't officially supported any more.

const storybook = require('@storybook/{APP}/standalone');

storybook({
  // options
});

Where the APP is one of the supported apps. For example:

const storybook = require('@storybook/react/standalone');

storybook({
  // options
});

Mode

Mode is defining what Storybook mode will be applied:

dev

run Storybook in a dev mode - similar to start-storybook in CLI

const storybook = require('@storybook/react/standalone');

storybook({
  mode: 'dev',
  // other options
});

static

build static version of Storybook - similar to build-storybook in CLI

const storybook = require('@storybook/react/standalone');

storybook({
  mode: 'static',
  // other options
});

Other options are similar to those in the CLI.

For "dev" mode:

port [number]           Port to run Storybook
host [string]           Host to run Storybook
staticDir <dir-names>   Directory where to load static files from, array of string mappings between localDir and remote path
configDir [dir-name]    Directory where to load Storybook configurations from
https                   Serve Storybook over HTTPS. Note: You must provide your own certificate information.
sslCa <ca>              Provide an SSL certificate authority. (Optional with "https", required if using a self-signed certificate)
sslCert <cert>          Provide an SSL certificate. (Required with "https")
sslKey <key>            Provide an SSL key. (Required with "https")
smokeTest               Exit after successful start
ci                      CI mode (skip interactive prompts, don't open browser)
quiet                   Suppress verbose build output

For "static" mode:

staticDir <dir-names>   Directory where to load static files from, array of strings mappings between localDir and remote path
outputDir [dir-name]    Directory where to store built files
configDir [dir-name]    Directory where to load Storybook configurations from
watch                   Enable watch mode
quiet                   Suppress verbose build output

Example:

const storybook = require('@storybook/angular/standalone');

storybook({
  mode: 'dev',
  port: 9009,
  configDir: './.storybook',
  staticDir: ['localDir', 'localDir/images:/images/public']
});
You can’t perform that action at this time.