Browsersync Command To Browse Directories

This is the command I run to launch a quick Browsersync session to serve a directory of files that shows indexes. `ngrok`` can be added to the mix to let you share files easily with someone else.

Code
browser-sync . --watch --directory --no-notify
Notes
  • This serves up the current directory you're in. Changing `.`` to some other path would serve that instead.

  • The `--watch`` flag watches for file changes and updates the browser accordingly

  • The `--directory`` flag is what sets Browsersync to serve a listing of files instead of a 404 if there's no index.html file

  • The `--no-notify`` flag turns of a notificaiton alert that shows up on the browser when an auto update occurs

  • Make sure to only serve directories you intend to if you use ngrok. (I mean, you should do it anyway, but especially if you're letting other folks see things)

Reference

ngrok