Skip to content

A toolchain-agnostic live reload tool that supports automatic reloading of the browser when a file is changed.

License

Notifications You must be signed in to change notification settings

diamondburned/saq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

saq

A toolchain-agnostic live reload tool that supports automatic reloading of the browser when a file is changed.

Basic Example

saq \
    -s http://localhost:8081 \
    -t localhost:8080 \
    -i ./... \
    -x .git \
    --gitignoreFile .gitignore \
    -- bash -c 'make build && ./build/main --http localhost:8081'
# or equivalently
saq -- bash -c 'make build && ./build/main --http localhost:8081'

Note: go run does not propagate signals to the child process, so you should not use go run with saq. See golang/go#40467.

How it works

saq acts as a reverse proxy. It works as follows:

  1. It injects a script into the HTML response that fetches an endpoint that blocks until a file change is detected.
  2. When a file change is detected, the server process is restarted, which saq then tries to connect by sending a HEAD request to the server.
  3. Once the server is up, the browser is reloaded.

Supported Platforms

saq only works on Linux due to its dependency on illarion/gonotify.

Help

Usage: ./saq [flags...] argv...
Flags:
  -x, --exclude strings          exclude directories/paths/globs (default [./.git,./.direnv,./vendor,*.tmpl])
      --generated-check string   command to check if a file is generated, executes $SHELL or /bin/sh otherwise (default "[[ $FILE == *.go ]] && grep \"^// Code generated by\" \"$FILE\"")
      --gitignore string         gitignore file to use, empty to disable (default ".gitignore")
  -i, --include string           include directory (default ".")
  -s, --source string            source URL of the upstream server (default "http://localhost:8081")
  -t, --target string            target address to listen on (default "localhost:8080")
  -v, --verbose                  verbose logging

Who made the name?

@FreezingSnail

About

A toolchain-agnostic live reload tool that supports automatic reloading of the browser when a file is changed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages