you only have to do this once
npm install -g browser-sync
- close and re-open terminal after installing it
In terminal, change directory
to the folder with your files (probably not literally named folder-with-html-stuff-in-it
, put your own name in)
cd ~/folder-with-html-stuff-in-it
In OS X, you can type cd
and then drag a folder in from finder, and it'll paste the full location path in for you β¨
To make sure you're in the right folder, you can do present working directory
command in terminal:
pwd
Once you're in the right folder in terminal, start browser-sync.
browser-sync start . -s --files "*.html, *.css"
this command will:
- run a server locally
- (so your html page can actually access images and css and etc - it wouldn't if you had just opened the html file directly)
- automatically open a browser to the
index.html
- the browser-sync process is automatically in sync with this chrome tab. Any time an
html
or css
file is changed, it will reload the page.
- This is now a process that's running. You can't type commands into the terminal while you're in a process. You can exit the process with
cmd+c
These were the important commands we ran:
npm install -g browser-sync
cd ~/folder-with-html-stuff-in-it
browser-sync start . -s --files "*.html, *.css"