Skip to content

How to reload the browser window when you save a file

New Course Coming Soon:

Get Really Good at Git

A quick and simple approach

I was working on a website in vanilla HTML + JS, and I missed one of the best feature provided by those quick start packages like create-react-app or the Vue CLI: reloading the page when I saved a file in the code editor.

The simplest way I found is to install browser-sync:

npm install -g browser-sync

then run it in your project folder:

browser-sync start --server --files "."

The above command watches all files in the current folder (and all subfolders) for changes, and launches a web server on port 3000, opening a browser window to connect to the server.

Any time you change a file, the browser will refresh.

Very useful while prototyping!

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching Summer 2024. Join the waiting list!

Here is how can I help you: