Sie sind auf Seite 1von 3

Browsersync Command Line Usage

First, either install Browsersync globally, or locally to your project (if you're using npm scripts) and
then run one of the following commands

$ browser-sync start [options] Start Browsersync

$ browser-sync init Create a configuration file

$ browser-sync reload Send a reload event over HTTP protocol

$ browser-sync recipe [name] Generate the files for a recipe

Command Help (since 2.12.0)

^ TOP

For help running a certain command, type $ browser-sync <command> --help, for example:

# Get help for the start command only

$ browser-sync start --help

# Get help for the recipe command only

$ browser-sync recipe --help

$ browser-sync start

^ TOP

--server, -s Run a Local server (uses your cwd as the web root)

--serveStatic, --ss Directories to serve static files from

--port Specify a port to use

--proxy, -p Proxy an existing server

--ws Proxy mode only - enable websocket proxying

--browser, -b Choose which browser should be auto-opened

--files, -f File paths to watch

--index Specify which file should be used as the index page

--plugins Load Browsersync plugins

--extensions Specify file extension fallbacks


--startPath Specify the start path for the opened browser

--https Enable SSL for local development

--directory Show a directory listing for the server

--xip Use xip.io domain routing

--tunnel Use a public URL

--open Choose which URL is auto-opened (local, external or tunnel), or provide a url

--cors Add Access Control headers to every request

--config, -c Specify a path to a configuration file

--host Specify a hostname to use

--logLevel Set the logger output level (silent, info or debug)

--reload-delay Time in milliseconds to delay the reload event following file changes

--reload-debounce Restrict the frequency in which browser:reload events can be emitted to


connected clients

--ui-port Specify a port for the UI to use

--watchEvents Specify which file events to respond to

--no-notify Disable the notify element in browsers

--no-open Don't open a new browser window

--no-online Force offline usage

--no-ui Don't start the user interface

--no-ghost-mode Disable Ghost Mode

--no-inject-changes Reload on every file change

--no-reload-on-restart Don't auto-reload all browsers following a restart

# Examples

# Start a server from the `app` directory, watching all files

$ browser-sync start --server 'app' --files 'app'

# Start a server from the `app` & `.tmp` directories (short hand)

# (requires 2.12.1)

$ browser-sync start -s 'app' '.tmp' -f 'app' '.tmp'

# Proxy a PHP app + serve static files & watch them


$ browser-sync start --proxy 'mylocal.dev' --serveStatic 'public' --files 'public'

# Start Browsersync from a config file

$ browser-sync start --config 'conf/browser-sync.js'

# Start Browsersync from a config file with overriding flags

$ browser-sync start --config 'conf/browser-sync.js' --port 4000

$ browser-sync recipe

^ TOP

--output, -o Specify an output directory

# Examples

# List all available recipes

$ browser-sync recipe ls

# Copy files for gulp.sass recipe

$ browser-sync recipe 'gulp.sass'

# Copy files for gulp.sass recipe into custom output directory

$ browser-sync recipe 'gulp.sass' -o 'my-project'

Das könnte Ihnen auch gefallen