[go: up one dir, main page]

100% found this document useful (1 vote)
105 views3 pages

Browsersync CLI Commands Guide

The document provides information on using Browsersync commands from the command line. It describes common commands like browser-sync start to start Browsersync, browser-sync init to create a configuration file, and browser-sync recipe to generate files for a recipe. It also provides details on options for the start command to configure Browsersync settings like the server, files to watch, browser to open, and more.

Uploaded by

Jesus Rodriguez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
105 views3 pages

Browsersync CLI Commands Guide

The document provides information on using Browsersync commands from the command line. It describes common commands like browser-sync start to start Browsersync, browser-sync init to create a configuration file, and browser-sync recipe to generate files for a recipe. It also provides details on options for the start command to configure Browsersync settings like the server, files to watch, browser to open, and more.

Uploaded by

Jesus Rodriguez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

Choose which URL is auto-opened (local, external


--open
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

Set the logger output level (silent, info or


--logLevel
debug)

Time in milliseconds to delay the reload event


--reload-delay
following file changes

Restrict the frequency in which browser:reload


--reload-debounce
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

Don't auto-reload all browsers following a


--no-reload-on-restart
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'

You might also like