3 ms·
1. No, it doesn't react to file additions/deletions at the moment, but as there's support for this in fnotify which is handling file change notifications [1] I'
by baalimago 2y ago
1. No, it doesn't react to file additions/deletions at the moment, but as there's support for this in fnotify which is handling file change notifications [1] I'll add this shortly. wd-41 is still quite early in development.
2. This was my initial idea as well: to simply inject the ws-load script tag on the fly. But it would require basically writing a static file server from scratch, which I didn't feel like doing (I have a blog to write, not static file servers!).
Currently the solution is based on the go standard library fileserver handler [2] which makes the solution simple and effective. So i decided on the mirrored approach with the idea that the result for the end user should be the same, apart for the temporary directory where the mirrored files lives. I haven't yet detected any speed-issues in the mirroring process or the file-watch process, which I think is the only downside (please correct me if I'm wrong).
[1]: https://pkg.go.dev/github.com/fsnotify/fsnotify#hdr-Watching_directories https://pkg.go.dev/github.com/fsnotify/fsnotify#hdr-Watching...
[2]: https://github.com/baalimago/wd-41/blob/main/cmd/serve/serve.go#L68 https://github.com/baalimago/wd-41/blob/main/cmd/serve/serve...