RetroFed Forum
Your home away from modern life.
I made very simple and extremely fast Live Reload Server in just pure lua
Post Reply
AuthorMessage
hypertown lemmy.world hypertown@lemmy.world
Joined: 2023-07-01
Quote

cross-posted from: https://lemmy.world/post/41297887

I really wanted a HTML live reload plugin that has statusline integration and does not depend on entire chromium to create a simple web server. I couldn't find anything I'd like so I've decided to make my own plugin.
I was kinda afraid that implementing websockets in lua would be terrible task but it turns out I didn't need to, because SSE exists.
HTTP is simple, watching for file changes as well so I got to work.
Result: Very small (Less than 500 lines of code) plugin that launches in 0.1-0.2ms! (It's amazing what you can do when you don't need to load whole V8 from Chromium to serve a simple webpage.
I also made support functions for statusline of two popular distors: NvChad and AstroNvim but you can also launch it from cmds if you prefer.

Since I'm kinda new to nvim & lua scripting I'd appreciate any feedback on what could be improved or just done better.
For now I plan to add more features inspired vscode's live-server extension although it most likely won't be exact copy of that extension.

Link:

GitHub Repository

1   Original
Post Reply
Back to top