malta-browser-refresh

malta plugin to refresh automatically the browser when relevant files are updated

Usage no npm install needed!

<script type="module">
  import maltaBrowserRefresh from 'https://cdn.skypack.dev/malta-browser-refresh';
</script>

README


npm version"> npm downloads npm downloads

This plugin can be used on: .html files and even on .md and .pug files after using the right plugin

It observers js and css files with a relative path and refreshes the browser automatically when one of those changes.

Options :
- mode : decide use the xhr mode or the ws mode; default is ws

warning : use this plugin only for development purposes

Sample usage:

malta app/source/index.html public -plugins=malta-browser-refresh[mode:\"xhr\"]

or in the .json file :

"app/source/index.html" : "public -plugins=malta-browser-refresh"

or in a script :

var Malta = require('malta');
Malta.get().check([
    'app/source/index.html',
    'public',
    '-plugins=malta-browser-refresh',
    '-options=showPath:false,watchInterval:500,verbose:0'
    ]).start(function (o) {
        var s = this;
        console.log('name : ' + o.name)
        console.log("content : \n" + o.content);
        'plugin' in o && console.log("plugin : " + o.plugin);
        console.log('=========');
    });