Node.js based forum software built for the modern web
feat: Add live reload functionality with Grunt watch and Socket.IO (#13489)
Eli Sheinfeld84d99a0fc775
diff --git a/Gruntfile.js b/Gruntfile.jsindex dcfa831cd6..53a4b7e06f 100644--- a/Gruntfile.js+++ b/Gruntfile.js@@ -174,6 +174,8 @@ module.exports = function (grunt) {}if (worker) {worker.send({ compiling: compiling });+ // Send livereload event via Socket.IO for instant browser refresh+ worker.send({ livereload: true });}});});diff --git a/src/start.js b/src/start.jsindex 99f3b662c5..a15aa44c6a 100644--- a/src/start.js+++ b/src/start.js@@ -115,6 +115,13 @@ function addProcessHandlers() {const translator = require('./translator');translator.flush();}+ } else if (msg && msg.livereload) {+ // Send livereload event to all connected clients via Socket.IO+ const websockets = require('./socket.io');+ if (websockets.server) {+ websockets.server.emit('event:livereload');+ winston.info('[livereload] Sent reload event to all clients');+ }}});}