A lightweight, fast, and simple browser sync tool written in Go. Automatically reloads your browser or refreshes CSS when files change in your project directory. Designed for rapid development workflows with minimal configuration.
5browsersync is named after its inspiration: 5server from VSCode and BrowserSync which is a cool tool but I didn't want to install NPM and manage all that.
You can just download the binary from the releases page. No need to build it yourself unless you want to.
- Automatic Browser Reload: Watches files and reloads the browser via WebSocket when changes are detected.
- CSS Hot Reload: Refreshes stylesheets without a full page reload.
- HTML Script Injection: Injects a sync script into served HTML files for seamless integration.
- Configurable via CLI: Flexible command-line options for directory, address, throttling, debounce, ignores, and more.
- Cross-platform: Runs anywhere Go is supported.
- Minimal Dependencies: Only uses fsnotify for file watching.
Download the binary from the releases page.
-
Clone the repository:
git clone https://github.com/teamcoltra/5browsersync.git cd 5browsersync
-
Build the binary:
go build -o 5browsersync ./cmd/5browsersync
-
(Optional) Install globally:
go install ./cmd/5browsersync
Start the sync server in your project directory:
./5browsersync --dir . --open
- By default, serves files from the current directory and injects the sync script into HTML files.
- Automatically opens your default browser to the server address if
--open
is specified.
Command-line flags:
Flag | Description | Default |
---|---|---|
--dir |
Directory to serve and watch | . |
--addr |
Address to bind (host:port) | :8080 |
--open |
Open browser on start | false |
--throttle |
Minimum ms between reloads | 0 |
--latency |
Artificial latency before reload | 0s |
--debounce |
Debounce interval for file events | 0s |
--noinject |
Disable HTML script injection | false |
--ignores |
Ignore patterns (can repeat) | |
--cors |
Enable permissive CORS headers | false |
Example:
./5browsersync --dir ./public --addr :3000 --open --ignores node_modules --debounce 200ms
Contributions are welcome! Please open issues or submit pull requests for bug fixes, features, or documentation improvements.
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature/my-feature
) - Open a pull request
This project is licensed under the MIT License. See LICENSE for details.
Zed doesn't yet have a native task runner UI like VS Code, but it does support custom command-line tasks via .zed/tasks.json
.
-
Open your project in Zed
-
Create a
.zed/tasks.json
file in the root of your project if it doesn't already exist:mkdir -p .zed touch .zed/tasks.json
-
Add the following content to
.zed/tasks.json
:{ "tasks": [ { "name": "Start 5browsersync", "cmd": ["5browsersync", "--dir", ".", "--open"], "cwd": "${projectRoot}" } ] }
name
: Will be the label shown in the task palette.cmd
: What Zed will execute.cwd
: The current working directory — using${projectRoot}
will always run it in the current project folder.
- Press
Cmd + Shift + P
(orCtrl + Shift + P
on Windows/Linux) to open the Command Palette - Type:
Tasks: Run Task
- Select:
Start 5browsersync
-
You can change
--dir
to point to a subdirectory likepublic/
if that's where your files live. -
If you always want CORS or debounce, just add the flags in
cmd
, like:"cmd": ["5browsersync", "--dir", ".", "--open", "--cors", "--debounce", "300ms"]
-
Make sure
5browsersync
is in your system$PATH
. You can test this by running5browsersync --help
in your terminal.
For questions, suggestions, or support:
- GitHub Issues: https://github.com/teamcoltra/5browsersync/issues