How to hot-reload your browser on file changes without needing JS

February 27th, 2025

charlesdeluvio-pjah2ax4uwk-unsplash.jpg

I recently had a situation where I needed to hot-reload the browser tab while making changes to files - in this case Laravel Blade templates. The project I work on has a Laravel Mix/Webpack setup which is configured for hot reloading but not for blade files. Yes - I could have set it up to perform hot reloading on blade files quite easily, but the compile time on this particular project is around 15 seconds which is too slow for my liking.

After a bit of DuckDuckGo-ing I found a Stack Overflow post with the following command:

fswatch -o ~/path/to/watch | xargs -n1 -I {} osascript -e 'tell application "Google Chrome" to tell the active tab of its first window to reload'

This works perfectly! Every change I made to my Blade templates immediately triggered a reload on the browser.

Note - this is Mac only.