4 ms·
Find a way with entr[0] and an http server to tell the browser to reload the currently viewed file if it changes. Today, entr allows you to restart a command w
by jiehong 4y ago
Find a way with entr[0] and an http server to tell the browser to reload the currently viewed file if it changes.
Today, entr allows you to restart a command when a file changes.
A web server allows you to serve local files to your browser.
If you use npm, lots of libs allow you to serve your web ui, and make the browser reload the page when something has changed.
But this is tied to npm, and even to the framework you use (eg: angular has its own way).
It would be cool if we could have a way to do that for any tool/language. Like, could a tool tell the browser to reload, because that tool was restarted by entr due to a file change?
This would allow live preview on any kind of files, or maybe even program output in the browser without having to press F5 every time.
[0]: https://github.com/clibs/entr https://github.com/clibs/entr
- frou_dh 4y agoIf I'm understanding you correctly, then this combination of two tools from the same author will get you that: https://github.com/cortesi/modd https://github.com/cortesi/modd https://github.com/cortesi/devd https://github.com/cortesi/devd
- jiehong 4y agoActually nice! Thanks! (Only works for html files, but that’s already good)
- dingleberry420 4y agohttp://livereload.com/ http://livereload.com/ https://www.npmjs.com/package/livereload https://www.npmjs.com/package/livereload https://github.com/guard/guard-livereload https://github.com/guard/guard-livereload if you search for livereload + whatever framework/language you use, you will probably find an implementation that integrates nicely. but the cli works just fine for anything, really.
- deleted 4y ago[deleted]
- high_byte 4y agomany projects allow web reload, see python httpwatcher for example.
- native_samples 4y agoIntellij does this (for html files at least)