perlmojolicioushot-reloadmojolicious-litemorbo

How can I auto-reload my Mojolicious website?


What is the best way to get auto-reloading to work when developing my website (my website runs on Mojolicious)?

There exists a development server called morbo, and it does update what is served automatically whenever I save changes to a source file, but the website itself does not reload automatically. I must manually refresh the page to see the changes.

What is a sane way to get this behavior? I am okay with using an additional tool if necessary.


Solution

  • My understanding is that Mojolicious::Plugin::AutoReload can do what you want by defining a auto_reload endpoint and having the UI poll your web app to check if the UI should reload.

    The module was featured on the Mojolicious blog in 2018.