gimm / gulp-live-server

serve your nodejs/static app live
148 stars 71 forks source link

livereload.js is not detecting changes. #72

Closed ParaSpl01t closed 1 year ago

ParaSpl01t commented 2 years ago

I have an file called app.js which uses express.js to serve some content on port 3000. I have manually added livereload.js to the html and the LiveReload object is available in browser console. This gulpfile reloads the app.js to restart the server but the page in the browser stays the same.

const gulp = require('gulp')
const gls = require('gulp-live-server')

const server = gls('app.js', undefined, 12345)

function restartExpress(cb) {
    server.start.bind(server)()
    server.notify.apply(server, [cb])
    cb()
}

exports.default = function () {
    server.start()
    gulp.watch(['./**/*', '!node_modules/**/*', '!db/**/*'], function (cb) {
        restartExpress(cb)
    })
}

Is the method correct or did I miss something?

ParaSpl01t commented 1 year ago

closing this as I managed to get it working in the past and I don't think there is any bug in the this project related to this.