Open kasper opened 9 years ago
Try activate :live_reload, host: '127.0.0.1', port: '4567'
@Arcovion Nope, doesn’t work.
middleman-site $ bundle exec middleman --verbose
== The Middleman is loading
== Activating: sprockets
== Reading: Local config
== Activating: livereload
== Activating: directory_indexes
== Activating: asset_hash
== Activating: minify_css
== Activating: minify_javascript
Loaded extensions:
== Extension: sprockets
== Extension: livereload
== Extension: directory_indexes
== Extension: asset_hash
== Extension: minify_css
== Extension: minify_javascript
== Extension: frontmatter
== File Change: .rubocop.yml
== File Change: .ruby-version
== File Change: config.rb
== File Change: LICENSE.md
== File Change: README.md
== File Change: source/assets/images/.keep
== File Change: source/assets/javascripts/.keep
== File Change: source/assets/stylesheets/style.css.scss
== File Change: source/index.html.haml
== File Change: source/layouts/layout.haml
== Rebuilding resource list
== LiveReload accepting connections from http://127.0.0.1:4567
[2015-01-23 11:50:01] INFO WEBrick 1.3.1
[2015-01-23 11:50:01] INFO ruby 2.2.0 (2014-12-25) [x86_64-darwin14]
== The Middleman is standing watch at http://0.0.0.0:4567
== Inspect your site configuration at http://0.0.0.0:4567/__middleman/
[2015-01-23 11:50:01] INFO WEBrick::HTTPServer#start: pid=838 port=4567
^C[2015-01-23 11:51:53] INFO going to shutdown ...
[2015-01-23 11:51:53] INFO WEBrick::HTTPServer#start done.
== The Middleman is shutting down
The server responds with an empty reply.
~ $ curl -v http://127.0.0.1:4567
* Rebuilt URL to: http://127.0.0.1:4567/
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 4567 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 127.0.0.1:4567
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
curl: (52) Empty reply from server
By the way, if I edit livereload settings while the server is running, I get an infinite loop of errors.
[2015-01-23 11:48:37] ERROR NoMethodError: undefined method `[]' for nil:NilClass
/Users/Kasper/.rbenv/versions/2.2.0/lib/ruby/2.2.0/webrick/server.rb:174:in `block in start'
With the default settings, I’m not even seeing livereload.js injected into my Haml-templates. Shouldn’t it be?
Actually, leave off the port
option - only change the host to 127.0.0.1
.
It should be injected on any html page with a
curl -v -H "Connection: Upgrade" -H "Upgrade: websocket" 127.0.0.1:35729
@Arcovion Ok. The WebSocket server is working with both the default settings and custom host. I can see curl connecting to Middleman as well. For some reason the livereload.js is not injected to the page.
middleman-site $ curl -v -H 'Connection: Upgrade' -H 'Upgrade: websocket' localhost:35729
* Rebuilt URL to: localhost:35729/
* Hostname was NOT found in DNS cache
* Trying ::1...
* connect to ::1 port 35729 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 35729 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:35729
> Accept: */*
> Connection: Upgrade
> Upgrade: websocket
>
< HTTP/1.1 101 Web Socket Protocol Handshake
< Upgrade: WebSocket
< Connection: Upgrade
< WebSocket-Origin:
< WebSocket-Location: ws://localhost:35729/
middleman-site $ curl -v -H 'Connection: Upgrade' -H 'Upgrade: websocket' 10.0.1.14:35729
* Rebuilt URL to: 10.0.1.14:35729/
* Hostname was NOT found in DNS cache
* Trying 10.0.1.14...
* Connected to 10.0.1.14 (10.0.1.14) port 35729 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 10.0.1.14:35729
> Accept: */*
> Connection: Upgrade
> Upgrade: websocket
>
< HTTP/1.1 101 Web Socket Protocol Handshake
< Upgrade: WebSocket
< Connection: Upgrade
< WebSocket-Origin:
< WebSocket-Location: ws://10.0.1.14:35729/
middleman-site $ curl -v http://localhost:4567
* Rebuilt URL to: http://localhost:4567/
* Hostname was NOT found in DNS cache
* Trying ::1...
* connect to ::1 port 4567 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 4567 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:4567
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 153
* Server WEBrick/1.3.1 (Ruby/2.2.0/2014-12-25) is not blacklisted
< Server: WEBrick/1.3.1 (Ruby/2.2.0/2014-12-25)
< Date: Fri, 23 Jan 2015 13:58:17 GMT
< Connection: Keep-Alive
<
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>Hello World!</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
* Connection #0 to host localhost left intact
Everything looks correct to me, could be a bug in the underlying rack-livereload
middleware (which is what injects the Githubissues.
I can’t seem to get the latest livereload and Middleman to work on OS X 10.10.1 and Ruby 2.2.0. It sometimes states it’s listening for browsers to connect, sometimes not. However no updates are pushed to Safari. Reloading manually works fine.
File
Gemfile
File
config.rb