How do I get the browser to auto refresh when ever I save new changes in my go or templates? I got the server to refresh with wgo but the client side (browser) does not refresh which makes it a hassle to develop.
Since I am using HTMX on the client side, I believed I could use that to force a refresh, but it did not seem to feasible without a super hacky solution
After doing some research, I found the browser-sync npm package, which can proxy the exposed port and can perform a refresh when code is changed.
To perform the refresh you will have to look for changes on Go and Templ files and ignore changes on '*_templ.go' files (which can cause multiple reloads when Templ generates them). This will also have to take place after your server refresh, which I'm using the WGO package for.
Here is an example bash script implementation to perform all necessary refreshing:
Example implementation repo