browser-sync
Synchronize browsers for web development testing
TLDR
Start a server from a specific directory
Start a server from local directory, watching all CSS files in a directory
Create configuration file
Start Browsersync from configuration file
SYNOPSIS
browser-sync [options] [path]
PARAMETERS
--files "globs"
Files/directories to watch for changes
e.g., CSS, HTML, JS patterns
--server ["path"]
Serve files from current (or given) directory
--proxy "url"
Proxy all requests to given URL/server
--watch
Watch project files for changes (default)
--no-open
Prevent automatic browser opening
--port <port>
Port for BrowserSync to bind (default: 3000)
--host <host>
Host IP to bind (default: localhost)
--ignore "globs"
Files/directories to exclude from watching
--tunnel ["subdomain"]
Expose via public tunnel URL
--https
Serve over HTTPS
--no-notify
Disable browser notifications
--ui
Enable BrowserSync UI control panel
--reload-delay <ms>
Delay before browser reload (default: 0)
--poll
Use filesystem polling instead of native watchers
-h, --help
Show help and options
DESCRIPTION
BrowserSync is a Node.js-based command-line tool designed for modern web development workflows.
It automatically monitors your project files for changes and synchronizes actions across multiple browsers and devices. Key capabilities include live reloading of CSS/JS changes without full page refreshes, full-page reloads for HTML/images, and synchronization of user interactions like clicks, scrolls, and form inputs.
Ideal for cross-browser and cross-device testing, it supports static file serving, proxying to backend servers, URL tunneling for external access, and HTTPS. Developers can watch specific file patterns, ignore directories, debounce reloads, and customize ports/UI.
Usage typically involves running browser-sync start --server --files "**/*.css, **/*.html" from the project root, opening synced browsers automatically. It enhances productivity by eliminating manual refreshes and ensuring consistent testing environments.
Requires Node.js/npm; not a native Linux binary.
CAVEATS
Requires Node.js/npm installation: npm install -g browser-sync.
Not suitable for production serving.
May conflict with firewalls/antivirus on watched dirs.
Polling (--poll) increases CPU on large projects.
INSTALLATION
npm install -g browser-sync
Verify: browser-sync --version
BASIC EXAMPLE
browser-sync start --server --files "css/*.css"
Serves ./, watches CSS, syncs browsers.
PROXY EXAMPLE
browser-sync start --proxy localhost:3000 --files "**/*.js"
Proxies backend, watches JS.
HISTORY
Created by Shane Osbourne in 2013 as open-source tool.
Popularized in Grunt/Gulp ecosystems; now CLI-focused.
Active development on GitHub with v2.30+ supporting modern Node/ESM.
SEE ALSO
http-server(1), live-server(1), nodemon(1)


