https://github.com/tmichel/devserver
A dev server for web development
https://github.com/tmichel/devserver
devserver hotreload livereload
Last synced: 7 days ago
JSON representation
A dev server for web development
- Host: GitHub
- URL: https://github.com/tmichel/devserver
- Owner: tmichel
- License: mit
- Created: 2024-10-10T20:55:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-13T10:06:22.000Z (6 months ago)
- Last Synced: 2025-07-13T12:25:35.370Z (6 months ago)
- Topics: devserver, hotreload, livereload
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# devserver
devserver is a reverse proxy and build server for web applications.
## Features
* Rebuild and restart when you hit Enter.
* Live reload on restarts and file changes
* Hot-reloading for CSS files: CSS files used via a `` tag are updated in
place without reloading the page.
## Installation
go install github.com/tmichel/devserver@latest
Under the hood `devserver` uses [fswatch][1] for monitoring file changes.
To install fswatch on macOS run the following
brew install fswatch
Detailed install instructions can be found in [fswatch's README][2].
## Usage
For details run
devserver -h
### Example
cd /path/to/your/project
devserver \
-build-cmd "go build -o bin/my-app" \
-web-root $PWD/files \
"bin/my-app -addr {}"
# visit http://localhost:8080
`serverCmd` defines the command for starting the server. Use `{}` as a
placeholder for the host and port. It is passed in the format of `host:port`.
`{port}` and `{host}` can also be used as placeholders.
`-build-cmd` defines the build command. Defaults to `make`. Set it to an empty
string to skip the build.
`-web-root` sets the root directory for files served by your web server. It is
used to compute absolute URLs for files. For example when `-web-root
/path/to/web-root` is set the file located at `/path/to/web-root/css/style.css`
will be reported as `/css/style.css`. This allows hot reloading CSS files.
### Example: using `go run`
Sometimes building and running are not separate. For example when using `go
run` to build and execute your program there is no separate build step. In
these situations you can specify `-build-cmd=""` to skip the build.
cd /path/to/your/project
devserver \
-build-cmd "" \
-web-root $PWD/files \
"go run . -addr {}"
# visit http://localhost:8080
[1]: https://github.com/emcrisostomo/fswatch
[2]: https://github.com/emcrisostomo/fswatch#installation