Is there something like nodemon in Rust?

1.5k views Asked by At

In javascript nodemon is a static files server that reloads on code changes. I am using wasm-pack and miniserve to do two commands:

build

wasm-pack build --target web --out-name wasm --out-dir ./static/build

serve:

miniserve ./static --index index.html

I would love these two to be automated just like in javascript with nodemon.

2

There are 2 answers

0
Julius Lungys On

Use cargo-watch and pass shell commands to execute using -s or --shell flags:

cargo watch -s 'wasm-pack build --target web --out-name wasm --out-dir ./static/build && miniserve ./static --index index.html'

Thanks for the help Lux and kmdreko

0
Airat Galiullin On

Use chobs. It can execute your command and restart it on changes.

chobs watch -e "crago run -- -f -e -b"

or any other exec.