home ~ projects ~ socials

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.

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)

TODO

    Link to ngrok posts

    Look into the --tunnel flag as another option instead of ngrok

    Figure out if there's a built in way to change the template used for directory listsing to dark mode

-- end of line --

References