Crates.io | floof |
lib.rs | floof |
version | 0.1.0 |
source | src |
created_at | 2020-09-23 10:01:14.71813 |
updated_at | 2020-09-23 10:01:14.71813 |
description | Language-agnostic, simple-to-use development server, file-watcher and tiny build system mainly useful for webdev. |
homepage | |
repository | https://github.com/LukasKalbertodt/floof/ |
max_upload_size | |
id | 292027 |
size | 122,797 |
Floof is a language and tech-stack agnostic, simple-to-use development server, file-watcher and tiny build system. It is mainly useful for web-development (i.e. where you inspect your software in the browser) due to its ability to automatically reload your app in the browser. For other projects, cargo watch or watchexec might be better suited (and those are way more mature).
Features:
Run arbitrary commands
Watch for file changes (with debouncing)
Automatically reload the page in your browser
HTTP server
Tiny build-system
Platform-independent file system operations (copy, ...)
Templates to support zero-configuration use in some situations
Currently the best way is to install from crates.io
.
You need Rust and Cargo to do that, as you compile the application yourself.
cargo install floof
At some point I will start attaching pre-compiled binaries to the GitHub releases.
A floof.yaml
is expected in the root folder of the project/in the directory you run floof
in (like Makefile
).
That file defines what actions need to be run and configures a bunch of other stuff.
The following is an example for a simple project that uses a Rust backend server that serves HTML and listens on port 3030.
default:
- concurrently:
- http:
proxy: 127.0.0.1:3030
- watch:
paths:
- Cargo.toml
- Cargo.lock
- src/
run:
- reload: # This will wait for port 3030 to become available
- cargo run # This long running command is killed on file changes
When running floof
in that directory, the output looks something like this:
════════════╡ [default][http] Listening on http://127.0.0.1:8030
════════════╡ ▶️ [default][command] running: cargo run
Compiling floof-example v0.0.0
Finished dev [unoptimized + debuginfo] target(s) in 2.21s
Running `target/debug/floof-example`
... output from your server application ...
════════════╡ ♻️ [default][http] Reloading all active sessions
You are then supposed to open localhost:8030
in your browser.
This will show exactly the same as your actual backend server (which is listening on localhost:3030
) as floof
works as a reverse proxy.
However, floof
injects a small JS snippet responsible for automatically reloading the page in your browser once something changes.
This snippet communicates with floof
via web sockets.
When changing a file:
════════════╡ 🛑 [default][watch] change detected while executing operations! Cancelling operations, then debouncing for 500ms...
════════════╡ 🔥 [default][watch] change detected: running all operations...
════════════╡ ▶️ [default][command] running: cargo run
... output from your server application ...
════════════╡ ♻️ [default][http] Reloading all active sessions
This project is really young and lots of stuff might still break! A lot of features are missing as well. I only started this project to help with developing another project I am working on.