middleman-livereload icon indicating copy to clipboard operation
middleman-livereload copied to clipboard

livereload port not passing through correctly to rack-livereload?

Open jacquescrocker opened this issue 11 years ago • 1 comments

I'm developing a project with multiple client apps (each using middleman) and I noticed that livereload was conflicting with each other. When I set :port option on each one, it was still not working.

here's how i'm setting it:

activate :livereload, port: 35740

the result was this in my <head> tag:

<script type="text/javascript">
  RACK_LIVERELOAD_PORT = 35729;
</script>
<script type="text/javascript" src="/__rack/livereload.js?host=0.0.0.0&amp;port=35740"></script>

Notice how the RACK_LIVERELOAD_PORT window variable isn't changing (but the script port is).

After some digging, this commit fixed things for me:

https://github.com/railsjedi/middleman-livereload/commit/4125b4afb7f6cd676f61a9d3d361f3d7051b12a1

I really don't understand the difference on rack-livereload between :port and live_reload_port but I know if I don't set both, it doesn't work.

Digging around the rack-livereload project:

it's using options[:port] here: https://github.com/johnbintz/rack-livereload/blob/master/lib/rack/livereload/body_processor.rb#L105

and it's using options[:live_reload_port] here: https://github.com/johnbintz/rack-livereload/blob/master/lib/rack/livereload/body_processor.rb#L13

and also here: https://github.com/johnbintz/rack-livereload/blob/master/skel/livereload.html.erb#L12

Hope this helps someone

jacquescrocker avatar Jun 30 '14 05:06 jacquescrocker

I'm doing some issue-gardening 🌿🌷🌾 and came across this issue.

Sorry that this has lingered for quite a while!

Thanks for your thorough digging into this! Do you have any suggestions for a remedy? Happy to review a PR!

(this repo is maintained by a few people contributing their free time, unfortunately we can't solve every issue on our own, so help from others is needed for some of the more exotic issues that crops up)

sandstrom avatar Jul 28 '17 09:07 sandstrom