Gulp: How to implement livereload without Chrome's livereload plugin?
Asked Answered
F

1

7

It looks like gulp-livereload requires Chrome's livereload plugin to work.

Is there a way to implement livereload that doesn't require any browser plugin, and will work in all browsers?

Any examples will be appreciated.

Folkrock answered 26/9, 2014 at 23:42 Comment(0)
B
13

How I've missed that.

You should add the livereload script in your index.html, and change the port to which you're currently using.

<script src="http://localhost:35729/livereload.js?snipver=1"></script>

You may want to inject this only on a development version, so I think you should have a look to gulp-inject to get this behaviour.

Bixler answered 27/9, 2014 at 0:20 Comment(2)
Thanks! Adding this script solved the problem. Could you just clarify where livereload.js is coming from? Is it available at localhost:35729 because of livereload.listen() in the gulpfile.js? Also, what snipver=1 does? (the docs are not clear)Folkrock
Indeed this script is available through the gulp-livereload plugin, for the snipver, you should have a look to this link, which explain it wellBixler

© 2022 - 2024 — McMap. All rights reserved.