Aral Balkan

Mastodon icon RSS feed icon

Site.js: now with auto server reload on source code changes

A quick demonstration of the new auto-reload feature.

Auto reload

Site.js version 12.9.7 brings the second developer experience improvement to Site.js in as many days with an integrated auto reload feature that responds to source code changes on dynamic sites.

Live reload yesterday, auto reload today

Following yesterday’s addition of live reload for static sites, today you get auto server reloads when the source code of your dynamic site changes.

This is the sort of functionality you’d normally implement by using excellent third-party tools like Remy’s nodemon. With Site.js, you now get it out of the box. No external process manager required.

So now, if you change the code in a DotJS route or even if you add or remove a new node module, the server will automatically restart.

Note that during development, it’s the server that restarts, not your whole process. That’s faster than a full reload of the whole Site.js process.

Seamless restarts on deployment when necessary

While the auto reload feature is a great help during development, it also makes your life much easier during deployment.

If you run Site.js in production using the enable command, your server will now automatically restart when you sync your changes to it. (And do so only if it needs to.)

None of this changes the behaviour of static page and asset updates which have always been, and continue to be, immediately available on deployment without requiring a server restart.

Have a play!

Screenshot of the Site.js basic chat example running on a Raspberry Pi 4B.

Yes, I’m going to keep mentioning the tutorial until you try it!

If you’re wondering what Site.js is, check out the Site.js web site and have a glance at the Site.js documentation.

There’s also a tutorial I released a few weeks ago that takes you through building static and dynamic sites with Site.js as you build a simple chat app using WebSockets.

I hope these improvements make your experience of creating with Site.js more delightful.

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.