oxequa / realize

Realize is the #1 Golang Task Runner which enhance your workflow by automating the most common tasks and using the best performing Golang live reloading.
GNU General Public License v3.0
4.46k stars 230 forks source link

Refresh browsers when binary file is rebuilt #169

Open stephenkoo opened 6 years ago

stephenkoo commented 6 years ago

Proposed feature:

stephenkoo commented 6 years ago

If this isn't a planned feature, could someone suggest what they use to automatically refresh a browser to reflect the latest changes?

asoseil commented 6 years ago

i need to check how its work a browser refresh system

stephenkoo commented 6 years ago

I think air & fresh does this: https://github.com/pilu/fresh https://github.com/cosmtrek/air

Edit: Just tested air, it doesn't seem to do this. Best resource I've found is:

s0kil commented 6 years ago

Great Idea.

trinode commented 6 years ago

I've been spending ages looking for a tool that does this in golang, I've become accustomed to it from other languages' web frameworks (which recompile and auto refresh the browser on file changes), this would be an awesome addition!

trinode commented 6 years ago

The way I imagine this working is we would include some javascript in our app which could be loaded from the realize web server

<script src="http://localhost:5001/autorefresh.js"></script>

(we could do this conditionally depending if we're running in production mode or not, I don't think it would be wise or worth the effort to have Realize proxy the app and inject the script)

I would contribute if you're desperate for someone else to do this, but I'm quite new to go - to the point where I'm looking for the best frameworks and code reload tools :-)

It seems that most of what needed would be in the example https://github.com/markvincze/golang-reload-browser that @stephenkoo posted.

asoseil commented 6 years ago

i prefer the proxy approach, but i don't know how to get the app url that could be preset or not depending on the type of project