automagic-systemjs-server

A SystemJS hot module replacer to loads file changes without full page refreshes.

Usage no npm install needed!

<script type="module">
  import automagicSystemjsServer from 'https://cdn.skypack.dev/automagic-systemjs-server';
</script>

README

A SystemJS hot module replacer to loads file changes without full page refreshes.

Usage Build Status

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