Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A minimal and scriptable way to refresh a webpage

License

NotificationsYou must be signed in to change notification settings

SimonMTS/herl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A minimal and scriptable way to refresh a webpage.

herl proxies requests to your website and injects a bit of javascript toallow remote page refreshes. Because it is just an HTTP proxy it is compatiblewith any backend language or framework.

Refreshes can be triggered withherl -n or by manually POSTing toherlsnotification endpoint. Of course you probably want to automate this byintegrating with your editor or an external file-watcher (the example directoryusesentr for generic on-save reloading).

In the below demo, because the index.html file is changed,entr callsherl -n which refreshes the browser, andgo run . which restarts theapplication. While the application is buildingherl retries calling theorigin server a few times until a connection can be established, so the browseronly sees one refresh.

demo

Usage

  1. Start a proxy server withherl -serve -origin https://example.com.
  2. Open the default proxy server url (http://127.0.0.1:3030) in the browser.
    This will show the content ofexample.com.
  3. Runherl -notify to refresh the page from the command line.

For all flags see:herl -help.

"Hot" or "live" reloading, as seen in modern frontend frameworks, can beachieved by combiningherl with, for example,entr.entr can be usedto execute a command when files change, seeexample/makefile for a workingexample.

Installation

Using the Go toolchain:go install s14.nl/herl@latest

From the AUR asherl-bin, so e.g.yay -S herl-bin

Thegithub releases page has downloads in the form of:.deb,.rpm, and.apk packages, and plain binaries.

Prior art

  • templ live-reload,the main inspiration for this project. Because it is built specifically foruse with templ, it is hard (if not impossible) to use on its own. Its scopeis also much bigger than that ofherl, it also includes thefunctionality ofentr, for example.
  • node-livereload, requireschanging your code, or installing a browser extension.
  • browser-sync, seemingly works in a similar way toherl, but has a lot more features and complexity. Written in node js.
  • entr reload-browser, doesn't seem to exist anymore, and worked by doingsome x.org magic to refresh browser tabs, if I remember correctly.
  • aarol/reload, requires changing yourcode, and is mainly intended to be used as a Go middleware.

[8]ページ先頭

©2009-2025 Movatter.jp