https://github.com/coolapso/go-live-server
A Simple development webserver with live reload capabilities written in Go
https://github.com/coolapso/go-live-server
cli development-tools web webserver
Last synced: 4 months ago
JSON representation
A Simple development webserver with live reload capabilities written in Go
- Host: GitHub
- URL: https://github.com/coolapso/go-live-server
- Owner: coolapso
- License: mit
- Created: 2024-11-16T13:42:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-16T21:43:58.000Z (over 1 year ago)
- Last Synced: 2025-04-04T14:51:10.220Z (about 1 year ago)
- Topics: cli, development-tools, web, webserver
- Language: Go
- Homepage: https://coolapso.sh
- Size: 349 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# go-live-server
[](https://github.com/coolapso/go-live-server/actions/workflows/release.yaml)
[](https://hub.docker.com/r/coolapso/go-live-server)
[](https://goreportcard.com/report/github.com/coolapso/go-live-server)

Go implementation of [tapio/liveserver](https://github.com/tapio/live-server). A Simple development web server written in go with live reload capabilities
## How it works
The server functions similarly to [tapio/liveserver](https://github.com/tapio/live-server). 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@latest`
#### Specific version
`go install github.com/coolapso/go-live-server@v1.0.0`
### 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](https://github.com/coolapso/go-live-server/releases).
* 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 [:heart: Sponsor Me](https://github.com/sponsors/coolapso) or
Also consider supporting [tapio/live-server](https://github.com/tapio/live-server) which inspired this project