gulp-community / gulp-livereload

gulp plugin for livereload
768 stars 67 forks source link

Where did livereload.js go? #60

Closed akbr closed 9 years ago

akbr commented 9 years ago

Just updated from v2.1.1 to v3.2.0.

I was relying on livereload.js, provided at "//[server]:35729/livereload.js", for a remote connection. But since updating, the javascript file has disappeared.

Is the javascript file still provided by gulp-livereload? Is there a better way to use livereload remotely? (The Chrome plugin seems restricted to localhost.)

cyrusdavid commented 9 years ago

@akbr, it's still there. Have you called .listen() first? It binds to localhost by default unless you specify a host option.

akbr commented 9 years ago

EDIT: It was the binding to localhost you mentioned. Thanks for your help!

@vohof Yup.

Here's the gulpfile:

var gulp = require('gulp');
var livereload = require('gulp-livereload');

gulp.task('watch', function() {
  livereload.listen();
  gulp.watch(['*.js', '*.html'], livereload.changed);
});

gulp.task("default", ['watch']);

and here's the relevant part of my index.html:

    <script>
      document.write('<script src="//' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>');
    </script>

This works with v2.1.1. But after updating to v3.2.0 -- changing nothing in either file -- I lose access to livereload.js from the browser.

From the console: GET http://[mydevdomain]:35729/livereload.js net::ERR_CONNECTION_REFUSED (where [mydevdomain] is the expected host)