Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zhaihaoran opened this issue Oct 9, 2016 · 9 comments
Open

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

zhaihaoran opened this issue Oct 9, 2016 · 9 comments

Comments

@zhaihaoran
Copy link

zhaihaoran commented Oct 9, 2016

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

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

@levithomason
Copy link

levithomason commented Oct 31, 2016

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
Copy link

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

@leedium
Copy link

leedium commented Nov 20, 2016

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

@levithomason
Copy link

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

@herebefrogs
Copy link

herebefrogs commented Dec 4, 2016

@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:

<script src="http://127.0.0.1:35729/livereload.js?ext=Chrome&extver=2.1.0"></script>

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
Copy link

@avevlad I guess the issue seems to be the <script src="http://127.0.0.1:35729/livereload.js?ext=Chrome&extver=2.1.0"></script> 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?

@levithomason
Copy link

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.

@aysenz
Copy link

aysenz commented May 22, 2017

Try close another livereload process)
port conflict)

@koertvankleef
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants