1.0.13 • Published 8 years ago
automagic-systemjs-server v1.0.13
A SystemJS hot module replacer to loads file changes without full page refreshes.
##1. Install
npm install --save-dev automagic-systemjs-server
##2. Launch the server
var automagic = require('automagic-systemjs-server');
automagic.init(options);
###init(options) ####port socket.io server port to start on
defaults 3912
####origins socket.io CORS
default '*:*'
####newConnectionCallback function invoked on a new connection
default console.log('...', new Date());
##3. Publish automagic.fileChanged
event to clients
gulp.watch(['*.js', '!node_modules/**'])
.on('change', function (e) {
var data = {
fileName: path.basename(e.path)
};
io.emit(automagic.fileChanged, data);
});
To retrieve theio
instance you can store it on initialisation var io = automagic.init()
or use the public getter automagic.io
##Server setup complete! Continue with the automagic client