Closed yuhere closed 1 month ago
The code below will add <script src="//myhost.com:443/livereload.js?snipver=1" async="" defer=""></script> to a html,
<script src="//myhost.com:443/livereload.js?snipver=1" async="" defer=""></script>
const app = express(); app.use(connect_livereload({ port: 443, }))
However, is most commonly cases, livereload is on the same server with the app, so using an empty port should be more convenient.
const app = express(); app.use(connect_livereload()) >> <script src="//myhost.com/livereload.js?snipver=1" async="" defer=""></script>
from: (index.js) var disableCompression = opt.disableCompression || false; var port = opt.port || 35729; var plugins = opt.plugins || [];
from: (index.js)
var disableCompression = opt.disableCompression || false; var port = opt.port || 35729; var plugins = opt.plugins || [];
function snippet(host) { var src = opt.src || '//' + host + ':' + port + '/livereload.js?snipver=1'; return [src].concat(plugins).map(function(source) { return ''; }).join(''); }
to: ``` javascript var disableCompression = opt.disableCompression || false; var port = opt.port; var plugins = opt.plugins || []; function snippet(host) { var src = opt.src || '//' + host + (port ? ':' + port: '') + '/livereload.js?snipver=1'; return [src].concat(plugins).map(function(source) { return '<script src="' + source + '" async="" defer=""></script>'; }).join(''); }
The code below will add
<script src="//myhost.com:443/livereload.js?snipver=1" async="" defer=""></script>
to a html,However, is most commonly cases, livereload is on the same server with the app, so using an empty port should be more convenient.
function snippet(host) { var src = opt.src || '//' + host + ':' + port + '/livereload.js?snipver=1'; return [src].concat(plugins).map(function(source) { return ''; }).join(''); }