Skip to content

Instantly share code, notes, and snippets.

@imrizzy
Created April 14, 2017 17:12
Show Gist options
  • Save imrizzy/c0ee20d3044377d723f7c8440905e01a to your computer and use it in GitHub Desktop.
Save imrizzy/c0ee20d3044377d723f7c8440905e01a to your computer and use it in GitHub Desktop.
How to get browsersync working with updating your coding files in real time. step-by-step after installing.
//browser-sync usage instructions
1. copy and paste the following into <BODY> tag of html file
<script id="__bs_script__">//<![CDATA[
document.write("<script async src='http://HOST:3006/browser-sync/browser-sync-client.js?v=2.18.8'><\/script>".replace("HOST", location.hostname));
//]]></script>
2. use TERMINAL to navigate into FOLDER that you want watched
cd [enter path]
3. use TERMINAL to start up browser-sync by typing the following
browser-sync start --server --files "stylesheets/*.css, *.html"
4. make sure "HOST" NUMBER in script (the same one copied and pasted into <BODY> tag of html file) is same as what's in ADDRESS BAR of the window that pops up after previous command line
if it isn't the same, change the number, save the file. then refresh the corresponding browser tab. it will stay connected and refresh any time you save the html file
REFERENCES:
https://www.browsersync.io/docs/command-line
http://stackoverflow.com/questions/28962528/browsersync-cannot-get
http://damonbauer.me/browsersync/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment