Skip to content

A Simple development webserver with live reload capabilities written in Go

License

Notifications You must be signed in to change notification settings

coolapso/go-live-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-live-server

Release Docker image version Go Report Card GitHub Sponsors

Go implementation of tapio/liveserver. A Simple development web server written in go with live reload capabilities

How it works

The server functions similarly to tapio/liveserver. It serves a directory and its subdirectories, and establishes a WebSocket connection by injecting a JavaScript snippet into every HTML file it serves. The server monitors changes in the directories it serves, and when changes occur, it sends a message via WebSocket to instruct the browser to reload the page.

Installation

Docker

You can run go-live-server with docker:

docker run -v $(pwd):/data -p 8080:8080 coolapso/go-live-server:latest

Now you can edit your html files and let go-live-server work its magic from within the docker container

Go Install

Latest version

go install github.com/coolapso/go-live-server

Specific version

go install github.com/coolapso/[email protected]

AUR

On Arch linux you can use the AUR go-live-server-bin

Linux Script

It is also possible to install on any linux distro with the installation script

Latest version

curl -L http://live-server.coolapso.sh/install.sh | bash

Specific version

curl -L http://live-server.coolapso.sh/install.sh | VERSION="v1.1.0" bash

Manual install

  • Grab the binary from the releases page.
  • Extract the binary
  • Execute it

Usage

go-live-server is a simple development webserver with live reloading capabilityes.
It allows you to quickly edit and visualize changes when developing simple html and css files

Usage:
  live-server [flags]
  live-server [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  version     Print live-server version

Flags:
      --browser            Enable or disable automatic opening of the browser (default true)
  -h, --help               help for live-server
      --open-file string   Specify the relative path to open the browser in the directory being served
  -p, --port string        The port server is going to listen on (default ":8080")
  -d, --watch-dir string   Sets the directory to watch for (default "./")

Use "live-server [command] --help" for more information about a command.

Build

With makefile

make build

Manually

go build -o go-live-server

Contributions

Improvements and suggestions are always welcome, feel free to check for any open issues, open a new Issue or Pull Request

If you like this project and want to support / contribute in a different way you can always ❤️ Sponsor Me or

Buy Me A Coffee

Also consider supporting tapio/live-server which inspired this project