feat: Add live reload functionality with Grunt watch and Socket.IO (#13489)

- Added livereload event to Grunt watch tasks for instant browser refresh
- Integrated Socket.IO WebSocket communication for real-time updates
- Enhanced development workflow with immediate file change detection
- Improved developer experience with automatic browser reload on file changes

Changes:
- Gruntfile.js: Send livereload message when files change
- src/start.js: Handle livereload events and broadcast via Socket.IO
This commit is contained in:
Eli Sheinfeld
2025-06-11 20:13:23 +03:00
committed by GitHub
parent 6c5b22684b
commit 84d99a0fc7
2 changed files with 9 additions and 0 deletions

View File

@@ -174,6 +174,8 @@ module.exports = function (grunt) {
} }
if (worker) { if (worker) {
worker.send({ compiling: compiling }); worker.send({ compiling: compiling });
// Send livereload event via Socket.IO for instant browser refresh
worker.send({ livereload: true });
} }
}); });
}); });

View File

@@ -115,6 +115,13 @@ function addProcessHandlers() {
const translator = require('./translator'); const translator = require('./translator');
translator.flush(); 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');
}
} }
}); });
} }