Skip to content
Shane Osbourne edited this page Jan 8, 2014 · 5 revisions

Whilst the preferred way to use browser-sync is via a config-file, there may be times when you'd just like to use browser-sync directly from the command-line with no config required.

Once you have installed Browser-Sync globally, you can move into any directory and use the following commands:

###Watching files

// Watch ALL CSS files in a directory for changes
browser-sync --files "app/css/*.css"
// Watch ALL CSS files & HTML files in a directory for changes
browser-sync --files "app/css/*.css, app/*.html"

###Watching files + your existing Server (proxy)

// Using a local.dev vhost
browser-sync --proxy "local.dev" --files "app/css/*.css"
// Using a local.dev vhost with PORT
browser-sync --proxy "local.dev:8001" --files "app/css/*.css"
// Using a an IP based host
browser-sync --proxy "192.167.3.2:8001" --files "app/css/*.css"

###Watching files + built-in static server (for html, js & css)

// Watch ALL CSS files for changes with a static server
browser-sync --files "app/css/*.css" --server
// Watch ALL CSS files for changes with a static server & specify that the base dir should be "app"
browser-sync --files "app/css/*.css" --server "app"

Watch ALL CSS files for changes with a static server & specify that the base dir should be "app" & specify the index file (note the missing l)

browser-sync --files "app/css/*.css" --server "app" --index "index.htm"
// Watch ALL CSS files for changes with a static server & specify that the base dir should be "app" & with ghostMode disabled
browser-sync --files "app/css/*.css" --server "app" --ghostMode false
Clone this wiki locally