gulp-connect icon indicating copy to clipboard operation
gulp-connect copied to clipboard

[Livereload] connect.reload doesn't work , please help me......

Open zhaihaoran opened this issue 8 years ago • 9 comments

thank you everyone! i find the answer to solve my problom

http://stackoverflow.com/questions/21699146/gulp-js-task-return-on-src

zhaihaoran avatar Oct 09 '16 10:10 zhaihaoran

Confirming the same issue here. Here's a repo: https://github.com/levithomason/gulp-connect-livereload

I've copied the example in the README.md to a repo with a single /app/index.html file and livereload does not work. npm start to run it. The html task does refire on html changes, but there is no reload happening.

This plugin was working for me some time ago, I'm going to see if I can find and older version that still works.

levithomason avatar Oct 31 '16 05:10 levithomason

Well, I cannot get v3/4/5 to work. Completely confused here.

levithomason avatar Oct 31 '16 05:10 levithomason

Try returning the stream so ie: gulp.task('html', function () { return gulp.src('./app/*.html') .pipe(connect.reload()); });

http://stackoverflow.com/questions/21699146/gulp-js-task-return-on-src

leedium avatar Nov 20 '16 10:11 leedium

The original project where the issue was noticed certainly returned all streams. The repo above is copied from the README.md, showing the example doesn't work.

https://github.com/AveVlad/gulp-connect/blob/master/README.md#livereload

levithomason avatar Nov 20 '16 17:11 levithomason

@zhaihaoran @levithomason I was able to make the livereload example from the README.md work by installing the LiveReload extension for Chrome: https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei

Then run 'gulp', load http://localhost:8080 in Chrome and click the 'LiveReload' icon in the top right corner of your location bar. This will inject the following script tag into your HTML page:

From now on, any change to a file that is watched will reload automatically in your browser.

Alternatively, I suppose you can do away with the Chrome extension by inlining that script tag in your HTML directly. Just remember to remove it when you ship your code.

Hope this helps.

herebefrogs avatar Dec 04 '16 03:12 herebefrogs

@AveVlad I guess the issue seems to be the isn't injected automatically in the HTML pages served by gulp-connect.

Is it part of the contract of gulp-connect to do so or not?

herebefrogs avatar Dec 04 '16 03:12 herebefrogs

Hm, I've never had the extension and this plugin worked for me once upon a time. After posting the issue here I switched to gulp-webserver as I needed something that worked right away. I'm not sure what the issue is but gulp-connect was working great in several projects, then suddenly was not.

levithomason avatar Dec 04 '16 07:12 levithomason

Try close another livereload process) port conflict)

aysenz avatar May 22 '17 01:05 aysenz

What made all the difference in my case was to execute the tasks as series (Gulp4) gulp.series('build', 'reload') And of course have any tasks prior to reload return a value.

koertvankleef avatar Jan 15 '18 11:01 koertvankleef