Giter Site home page Giter Site logo

middleman-livereload's Introduction

Middleman - Makes developing websites simple

Gem Version CI License

Middleman is a static site generator using all the shortcuts and tools in modern web development. Check out middlemanapp.com for detailed tutorials, including a getting started guide.

Why Middleman?

These days, many websites are built with an API in mind. Rather than package the frontend and the backend together, both can be built and deployed independently using the public API to pull data from the backend and display it on the frontend. Static websites are incredibly fast and require very little RAM. A front-end built to stand-alone can be deployed directly to the cloud or a CDN. Many designers and developers simply deliver static HTML/JS/CSS to their clients.

  • Uses Sass for DRY stylesheets.
  • Bring your own asset pipeline (WebPack, Babel, Sprockets or any other).
  • Easy templating with ERb or Haml.

Middleman gives the stand-alone developer access to all these tools and many, many more.

Installation

Middleman is built on Ruby and uses the RubyGems package manager for installation. These are usually pre-installed on Mac OS X and Linux. Windows users can install both using RubyInstaller. For windows RubyInstaller-Devkit is also required.

gem install middleman

Getting Started

Once Middleman is installed, you will have access to the middleman command. First, let's create a new project. From the terminal:

middleman init MY_PROJECT

This will create a new Middleman project located in the "MY_PROJECT" directory. This project contains a config.rb file for configuring Middleman and a source directory for storing your pages, stylesheets, javascripts and images.

Change directories into your new project and start the preview server:

cd MY_PROJECT
middleman server

The preview server allows you to build your site, by modifying the contents of the source directory, and see your changes reflected in the browser at: http://localhost:4567/

To get started, simply develop as you normally would by building HTML, CSS, and Javascript in the source directory. When you're ready to use more complex templates, simply add the templating engine's extension to the file and start writing in that format.

For example, say I am working on a stylesheet at source/stylesheets/site.css and I'd like to start using Compass and Sass. I would rename the file to source/stylesheets/site.css.scss and Middleman will automatically begin processing that file as Sass. The same would apply to CoffeeScript (.js.coffee), Haml (.html.haml) and any other templating engine you might want to use.

Finally, you will want to build your project into a stand-alone site. From the project directory:

middleman build

This will compile your templates and output a stand-alone site which can be easily hosted or delivered to your client. The build step can also compress images, employ Javascript & CSS dependency management, minify Javascript & CSS and run additional code of your choice. Take a look at the config.rb file to see some of the most common extensions which can be activated.

Learn More

A full set of in-depth instructional guides are available on the official website at: http://middlemanapp.com.

Additionally, up-to-date generated code documentation is available on RubyDoc.

Community

The official community forum is available at: http://forum.middlemanapp.com

Bug Reports

Github Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems: https://github.com/middleman/middleman/issues

The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit Pull Requests containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.

How to Run Cucumber Tests

  1. Checkout Repository: git clone https://github.com/middleman/middleman.git
  2. Install Bundler: gem install bundler
  3. Run bundle install inside the project root to install the gem dependencies.
  4. Run test cases: bundle exec rake test

Donate

Click here to lend your support to Middleman

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked and/or a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:

gem 'middleman', '~> 4.0'

License

Copyright (c) 2010-2023 Thomas Reynolds. MIT Licensed, see LICENSE for details.

middleman-livereload's People

Contributors

aaabramov avatar amirnissim avatar arcovion avatar benedikt avatar bhollis avatar bradgessler avatar cbetta avatar defeated avatar demersdesigns avatar imme-emosol avatar jessepollak avatar johnnyshields avatar karlfreeman avatar komor72 avatar michaelbaudino avatar nuclearpidgeon avatar sandstrom avatar sigmike avatar tdreyno avatar zhusee2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

middleman-livereload's Issues

Should we ~> 3.1.0 or maybe ~> 3.3.0?

The Readme.md for this plugin still instructs to put gem "middleman-livereload", "~> 3.1.0" in the Gemfile. Shouldn’t we already depend on 3.3.x current version?

Livereload not working with asset-hashing enabled outside of the build-block

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

gem 'middleman', '3.3.7'
gem 'middleman-livereload', '3.4.2'

File config.rb

activate :livereload
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: config.rb
== 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://10.0.1.14:35729
[2015-01-22 18:27:15] INFO  WEBrick 1.3.1
[2015-01-22 18:27:15] 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-22 18:27:15] INFO  WEBrick::HTTPServer#start: pid=4117 port=4567
== Request: /
== Finishing Request: index.html (0.01s)
== File Change: source/index.html.haml
== Rebuilding resource list
LiveReload: File changed - source/index.html.haml
== LiveReloading path: /
^C[2015-01-22 18:28:10] INFO  going to shutdown ...
[2015-01-22 18:28:10] INFO  WEBrick::HTTPServer#start done.
== The Middleman is shutting down

Browser cannot connect when the host is set to `0.0.0.0` (default)

I tried both on Windows and Linux, both with Firefox and Chrome, Middlman 3.1 and 3.2.

Firefox reports this:

Firefox can't establish a connection to the server at ws://0.0.0.0:35729/livereload.
http://localhost:4567/__rack/livereload.js?host=0.0.0.0&port=35729
Line 191: this.socket = new this.WebSocket(this._uri);

Chrome just reports nothing.

Middleman says "LiveReload is waiting for a browser to connect" but never "browser connected".

UPD: see discussion for updates.

Middleman + Livereload + Pow

I have problem to use middleman-livereload with pow. After insert this line to config.rb

activate :livereload, :host => "project.dev"

Pow is displaying error

Error starting application
Your Rack app raised an exception when Pow tried to run it.
Error: Response was not received
Error: Response was not received
    at Client._finishRequest (/Users/kierzniak/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/client.js:77:27)
    at Client.<anonymous> (/Users/kierzniak/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/client.js:38:21)
    at Client.emit (events.js:88:20)
    at Array.0 (net.js:335:10)
    at EventEmitter._tickCallback (node.js:190:38)

I assume that middleman-livereload is adapted to middleman server but if there is any chance to use it with pow?

Middleman with vagrant, live reload does not work

Hello,

Middleman inside vagrant is not live reloading site in safari/firefox/chrome.

Running middleman inside vagrant shows the following message:

== The Middleman is loading
== **+** LiveReload is waiting for a browser to connect
== The Middleman is standing watch at http://0.0.0.0:4567
== Inspect your site configuration at http://0.0.0.0:4567/__middleman/

Notice the plus (+) before LiveReload. This does not show up during a native middleman server run.
Also whenever any browser connects the following message is shown, which doesn't show up in native middleman run:

LiveReload Browser URL: {"command":"hello","protocols":["http://livereload.com/protocols/official-6","http://livereload.com/protocols/official-7"],"ver":"2.0.8"}

In firefox console log I get this:

The connection to ws://127.0.0.1:35729/livereload was interrupted while the page was loading.

Please help. I don't quite understand what is happening. Also I have tried agent forwarding in ssh as well, but to no avail.

Thank You.

undefined method `ip_address' for nil:NilClass

$ bin/middleman
== The Middleman is loading
ruby/gems/2.1.0/gems/middleman-livereload-3.3.3/lib/middleman-livereload/extension_3_1.rb:10:in `<class:LiveReloadExtension>': undefined method `ip_address' for nil:NilClass (NoMethodError)

looks related to this recent-ish commit: fba874a

(If i bundle open this gem and change it back to use localhost, i can boot the middleman server)

live reload when on 404 page

  1. Go to /x.html
  2. Get 404 page
  3. Create /source/x.html

Expected: catch the change and live reload.
Actual: no reload is performed as 404 page doesn't have livereload JavaScripts.

<html><body><h1>File Not Found</h1><p>/x.html</p></body>

Related to #58 but definitely a different feature, hence a new issue.

undefined method `ip_address' for nil:NilClass when not connected to internet?

I've run into this weird error. It seems to only happen if I don't have an internet connection:

= The Middleman is loading
/Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-livereload-3.3.3/lib/middleman-livereload/extension_3_1.rb:10:in `<class:LiveReloadExtension>': undefined method `ip_address' for nil:NilClass (NoMethodError)
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-livereload-3.3.3/lib/middleman-livereload/extension_3_1.rb:5:in `<module:Middleman>'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-livereload-3.3.3/lib/middleman-livereload/extension_3_1.rb:4:in `<top (required)>'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-livereload-3.3.3/lib/middleman-livereload.rb:5:in `require'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-livereload-3.3.3/lib/middleman-livereload.rb:5:in `block in <top (required)>'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/extensions.rb:43:in `call'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/extensions.rb:43:in `load'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/core_extensions/extensions.rb:103:in `activate'
    from /Users/sacha/Dev/tmb/config.rb:138:in `initialize'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/core_extensions/extensions.rb:162:in `instance_eval'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/core_extensions/extensions.rb:162:in `initialize'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/core_extensions/data.rb:35:in `initialize'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/application.rb:187:in `initialize'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/core_extensions/request.rb:52:in `new'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/core_extensions/request.rb:52:in `inst'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/preview_server.rb:103:in `new_app'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/preview_server.rb:21:in `start'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/cli/server.rb:79:in `server'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/cli.rb:76:in `method_missing'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/command.rb:29:in `run'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/command.rb:126:in `run'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/lib/middleman-core/cli.rb:22:in `start'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/gems/middleman-core-3.3.2/bin/middleman:18:in `<top (required)>'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/bin/middleman:23:in `load'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/bin/middleman:23:in `<main>'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/sacha/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'

Not a huge problem, but I thought I'd make a note of it :)

LiveReload not working with Stylus

Ok, here's the scenario:

A stylesheet called main.styl hold references to every other file preceded with an underscore (_), so middleman can ignore them. If I do that, only one file is being built (or previewed) called main.css. If I make changes to main.styl, changes are applied automatically.

If I make changes to files that are being imported, say _menu.styl, nothing happens and I have to restart the preview server and then reload the webpage in the browser. If I rename it to menu.styl a menu.css is created... so defeat the purpose to import files in a specific order.

Am I missing something? Or maybe I'm not understanding how livereload it's supposed to work?


Of course I should add to that:

Changed! source/stylesheets/_menu.styl
== LiveReloading path: /home/pablo/dev/web/test/source/stylesheets/_menu.styl

Trying to force the main.styl to be "livereloaded" neither solves the problem.

Custom host & port settings ignored

In my config I've added the following...

activate :livereload, :host => '10.0.1.21', :port => '8080'

Middleman is still defaulting to http://0.0.0.0:4567

However, running "middleman server -h '10.0.1.21' -p '8080' " from the command line works perfectly.

Would be better if Middleman LiveReload didn't use a hard IP address

Please consider embedding the LiveReload script the way LiveReload app itself advises:

<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>

Currently Middleman embeds the script with a hard 0.0.0.0 IP address, and this doesn't work when testing with mobile devices over my WiFi network (because I'm browsing to my Mac's IP, not 0.0.0.0).

Specifying an IP in config.rb isn't optimal because my Mac's IP changes depending on whether I'm home or at work.

Not working with 3.0.14

Hello,

I've added the bundle on middleman 3.0.14, activated in config.rb, restarted server, console shows:

== The Middleman is loading
== LiveReload is waiting for a browser to connect
== The Middleman is standing watch at http://0.0.0.0:4567
== LiveReloading path: index.html

but the page is not reloading.

This is the chrome developers toolbar output:

schermata 2013-05-15 alle 15 50 27

And there is no page reload

middleman-livereload crashing on windows w/ ruby 1.9.3 (em-websocket properly referenced)

Middleman crashes after launch+browser-initialted pageload on Windows 7 64-bit running ruby 1.9.3p448 (32-bit). Everything works fine with the activereload line commented out.

I included the em-websocket gem from github as instructed; added the extra livereload options one by one. The same gemfile works fine on Ubuntu/ruby 2.0.

Any ideas?

The error message:

Net::HTTPBadResponse at /
wrong status line: "(function() {"

Ruby  C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in read_status_line, line 2565
Web GET localhost/

Gemfile:

gem "middleman", "~>3.2.2"
# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"
# For faster file watcher updates on Windows:
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
gem "sass", "~> 3.3.2"
gem "compass", "~> 1.0.0.alpha.19"
gem "em-websocket", git: "https://github.com/igrigorik/em-websocket.git"

config.ru:

activate :livereload, :apply_js_live => false, :apply_css_live => false, :host => 'localhost'
set :css_dir, 'css'
set :js_dir, 'js'
set :images_dir, 'img'

error traceback:

C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in read_status_line
          raise HTTPBadResponse, "wrong status line: #{str.dump}"...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in read_new
        httpv, code, msg = read_status_line(sock)...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in block in transport_request
          res = HTTPResponse.read_new(@socket)...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in catch
      res = catch(:response) {...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in transport_request
      res = catch(:response) {...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in request
      res = transport_request(req, &block)...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in block in request
          return request(req, body, &block)...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in start
          return yield(self)...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in request
        start {...
C:/Ruby193/lib/ruby/1.9.1/net/http.rb: in send_request
      request r, data...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload/body_processor.rb: in use_vendored?
            http.send_request('GET', uri.path)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload/body_processor.rb: in livereload_source
        if use_vendored?...
(erb): in block (2 levels) in process!
C:/Ruby193/lib/ruby/1.9.1/erb.rb: in eval
      eval(@src, b, (@filename || '(erb)'), 0)...
C:/Ruby193/lib/ruby/1.9.1/erb.rb: in result
      eval(@src, b, (@filename || '(erb)'), 0)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload/body_processor.rb: in block (2 levels) in process!
            line.gsub!(HEAD_TAG_REGEX) { |match| %{#{match}#{template.result(binding)}} }...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/string/output_safety.rb: in gsub!
            super                                   #   super...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/string/output_safety.rb: in gsub!
            super                                   #   super...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload/body_processor.rb: in block in process!
            line.gsub!(HEAD_TAG_REGEX) { |match| %{#{match}#{template.result(binding)}} }...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload/body_processor.rb: in each
        @new_body.each do |line|...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload/body_processor.rb: in process!
        @new_body.each do |line|...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload.rb: in _call
        processor.process!(env)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-livereload-0.3.15/lib/rack/livereload.rb: in call
      dup._call(env)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/showexceptions.rb: in call
      @app.call(env)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/head.rb: in call
    status, headers, body = @app.call(env)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/lint.rb: in _call
      status, headers, @body = @app.call(env)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/lint.rb: in call
      dup._call(env)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb: in call
      to_app.call(env)...
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb: in service
        status, headers, body = @app.call(env)...
C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb: in service
      si.service(req, res)...
C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb: in run
          server.service(req, res)...
C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb: in block in start_thread
          block ? block.call(sock) : run(sock)

Using it on a remote server

I can't tell if this is something that I'm doing wrong, or if it's a bug with middleman or livereload, but I'm unable to get it to work correctly on my remote server set-up.

I've got a Debian machine (called green) which I use for all my development. Seeing as middleman comes with its own development server built in, I've been running that and have been able to successfully connect to via: http://green:4567/

So far so good

The issues start when I try to enable livereload, which I do by adding activate :livereload to my config.rb file. So far as I can tell, livereload is working as intended as I get the starting message:

== LiveReload is waiting for a browser to connect

But when connecting to the site using the link above, my livereload addon automatically enables itself, but I started to get a bunch of aborted connections to http://0.0.0.0:35729/livereload showing in firebug.

I've tried to edit the config.rb file to include the name and ip of the server (i.e. activate :livereload, :host => 'green'), but this hasn't worked, nor has my trick of getting livereload to work with Guard, which is to set-up a local tunnel to the remove server for port 35729.

All in all, I'm a bit lost as to how to solve this problem - can someone point me in the right direction? Thank you.

livereload breaks when editing with vim's 'backupcopy' set to 'no' / 'auto'

NB: the earliest description isn't correct in its assumtions, see my later comment for the correct analysis and a workaround.

If middleman server is started on linux without 'rb-inotify' gem, listen warns about being in polling mode, but everything seems to work fine.

If 'rb-inotify' is added to the Gemfile, livereload breaks:

  • in the console the server reports:
    LiveReloading path: /home/myname/path/to/the/asset.html.haml
    LiveReloading path: asset.html

instead of just LiveReloading path: asset.html

  • in the browser it says

    File not found

    /asset.html

Can't set no_swf to true?

Set this in config.rb

activate :livereload, :no_swf => true

and it gives me this:

/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.2.1/lib/middleman-core/configuration.rb:157:in `define_setting': Setting no_swf doesn't exist (RuntimeError)

Am I doing it wrong?

Ignore files and folders

This is more like a feature request (if it's not there yet).

Is there any way to tell LiveReload not to watch specific files or folders?

500 error for some images — 'Content-Length header was 0, but should be 1468'

Hi,

I’m debugging a situation where some images fail to transfer to the browser with a 500 error. ‘middleman server —verbose’ shows me the following Rack lint error:

[2014-03-18 16:33:03] ERROR Rack::Lint::LintError: Content-Length header was 0, but should be 1468

How would I be able to narrow this down to certain gem or middleman feature?

Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (3.2.17)
      i18n (~> 0.6, >= 0.6.4)
      multi_json (~> 1.0)
    addressable (2.3.5)
    atomic (1.1.16)
    chunky_png (1.3.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.7.0)
    compass (0.12.3)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (= 3.2.14)
    docile (1.1.3)
    em-websocket (0.5.0)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.5.3)
    eventmachine (1.0.3)
    execjs (1.4.0)
      multi_json (~> 1.0)
    exifr (1.1.3)
    favicon_maker (1.1.2)
      docile (~> 1.1.3)
      mini_magick (~> 3.7)
    ffi (1.9.3)
    fspath (2.0.6)
    fssm (0.2.10)
    haml (4.0.5)
      tilt
    hike (1.2.3)
    http_parser.rb (0.5.3)
    i18n (0.6.9)
    image_optim (0.9.1)
      exifr (~> 1.1.3)
      fspath (~> 2.0.5)
      image_size (~> 1.1.2)
      in_threads (~> 1.2.0)
      progress (~> 3.0.0)
    image_size (1.1.5)
    in_threads (1.2.0)
    json (1.8.1)
    kramdown (1.3.3)
    listen (1.3.1)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
      rb-kqueue (>= 0.2)
    middleman (3.2.2)
      coffee-script (~> 2.2.0)
      compass (>= 0.12.2)
      execjs (~> 1.4.0)
      haml (>= 3.1.6)
      kramdown (~> 1.2)
      middleman-core (= 3.2.2)
      middleman-sprockets (>= 3.1.2)
      sass (>= 3.1.20)
      uglifier (~> 2.4.0)
    middleman-blog (3.5.2)
      addressable (~> 2.3.5)
      middleman-core (~> 3.2)
      tzinfo (>= 0.3.0)
    middleman-core (3.2.2)
      activesupport (~> 3.2.6)
      bundler (~> 1.1)
      i18n (~> 0.6.9)
      listen (~> 1.1)
      rack (>= 1.4.5)
      rack-test (~> 0.6.1)
      thor (>= 0.15.2, < 2.0)
      tilt (~> 1.4.1)
    middleman-favicon-maker (3.5.3)
      favicon_maker (~> 1.1.2)
      middleman-core (>= 3.0.0)
    middleman-imageoptim (0.1.4)
      image_optim (~> 0.9.1)
      middleman-core (>= 3.0)
    middleman-livereload (3.2.1)
      em-websocket (~> 0.5.0)
      middleman-core (~> 3.2)
      multi_json (~> 1.8.4)
      rack-livereload (~> 0.3.15)
    middleman-slim (0.1.1)
      middleman (~> 3.2)
      slim (~> 2.0)
    middleman-sprockets (3.3.1)
      middleman-core (>= 3.2)
      sprockets (~> 2.1)
      sprockets-helpers (~> 1.0.0)
      sprockets-sass (~> 1.0.0)
    mini_magick (3.7.0)
      subexec (~> 0.2.1)
    multi_json (1.8.4)
    progress (3.0.0)
    rack (1.5.2)
    rack-livereload (0.3.15)
      rack
    rack-rewrite (1.5.0)
    rack-test (0.6.2)
      rack (>= 1.0)
    rake (10.1.1)
    rb-fsevent (0.9.4)
    rb-inotify (0.9.3)
      ffi (>= 0.5.0)
    rb-kqueue (0.2.2)
      ffi (>= 0.5.0)
    sass (3.2.14)
    slim (2.0.2)
      temple (~> 0.6.6)
      tilt (>= 1.3.3, < 2.1)
    sprockets (2.12.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-helpers (1.0.1)
      sprockets (~> 2.0)
    sprockets-sass (1.0.3)
      sprockets (~> 2.0)
      tilt (~> 1.1)
    subexec (0.2.3)
    susy (1.0.9)
      compass (>= 0.12.2)
      sass (>= 3.2.0)
    temple (0.6.7)
    thor (0.18.1)
    thread_safe (0.3.0)
      atomic (>= 1.1.7, < 2)
    tilt (1.4.1)
    tzinfo (1.1.0)
      thread_safe (~> 0.1)
    uglifier (2.4.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)

PLATFORMS
  ruby

DEPENDENCIES
  kramdown
  middleman
  middleman-blog
  middleman-favicon-maker
  middleman-imageoptim
  middleman-livereload
  middleman-slim
  rack-rewrite
  rake
  susy (~> 1.0.5)

Livereload + lots of changes = bad times

Not sure if this is a livereload issue or middleman-livereload issue, but I have not experienced this when using livereload in any other context.

When I make a bunch of changes, say, switching from one branch to another where I have moved a folder with 100+ files in it, livereload kicks off a page reload per file, which usually results in me having to launch activity monitor and kill ruby, otherwise it will reload 100+ times in a row. Terminating the middleman process via ctrl + c doesn't stop it.

I haven't seen anyone else complaining about it, so it's possible I'm just not configured properly.

Ignore directory

Hi, I'm not sure if this is a problem, or if it's something I can just let slide, but livereload is causing the page to reload when files in my IDE's project folder are updated, i.e.

== The Middleman is standing watch at http://0.0.0.0:4567
== LiveReloading path: index.html
== LiveReloading path: /srv/www/middleman.tld/.idea/workspace.xml

How can I get livereload to ignore the .idea folder?

My current config.ru file has this line:

activate :livereload, :host => '192.168.0.100'

I've tried adding :ignore => ***** to the end of it, but I don't know the correct syntax to use.

Cheeers.

multi_json conflicts prevent activation of livereload

Hi, when I am running middleman init I get multi_json conflicts (see below).

I can fix this by removing
gem uninstall multi_json --version 1.9.2 and afterwards
gem uninstall multi_json --version 1.9.0 so that only
multi_json 1.8.4 remains, but the newer versions of multi_json are quickly re-installed. Can you help? Thanks.

C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:2064:in `raise_if_conflicts': Unable to activate middleman-livereload-3.2.1, because multi_json-1.9.2 conflicts with multi_json (~> 1.8.4) (Gem::LoadError)
    from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1262:in `activate'
    from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:196:in `rescue in try_activate'
    from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:193:in `try_activate'
    from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
    from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/middleman-core-3.2.2/lib/middleman-core/extensions.rb:71:in `block in load_extensions_in_path'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/middleman-core-3.2.2/lib/middleman-core/extensions.rb:70:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/middleman-core-3.2.2/lib/middleman-core/extensions.rb:70:in `load_extensions_in_path'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/middleman-core-3.2.2/lib/middleman-core/load_paths.rb:40:in `setup_load_paths'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/middleman-core-3.2.2/bin/middleman:10:in `<top (required)>'
    from C:/Ruby193/bin/middleman:23:in `load'
    from C:/Ruby193/bin/middleman:23:in `<main>'

middleman-livereload 3.1.0 not working with middleman 3.2.0

The very first line in my config is:

activate :livereload, :apply_js_live => false

However livereload calls never hit the browser. When I start up middleman server

bundle exec middleman server --verbose

I see the message

== LiveReload is waiting for a browser to connect

But I never see the message "== Livereload browser connected" after I open the page in my browser.

I do, however, see the == LiveReloading path: ... messages.

Any ideas?

My Gemfile looks like this:

gem "middleman", "~> 3.2.0"
gem "middleman-livereload", "~> 3.1.0"

live reload when on an error page

Live reload works great until an exception is not raised. When a stacktrace is shown, live reload will no longer reload the page on file change. I have to do that manually by hitting F5 in the browser.

CSS not being applied live for @import-ed files.

I’m on middleman (3.2.2) and middleman-livereload (3.2.1). Whenever I make a change on all.css.scss, the CSS is applied live. But if said change is made in a file that all.css.scss imports with the Sass @import directive, the whole page is reloaded.

I believe this wasn’t happening when I first started this Middleman project, but now it is. However, I can’t pinpoint the culprit. Any idea why is this happening?

Update: This still happens with middleman-livereload 3.3.0

Javascript Error when using 1Password Browser Addon

Not sure if there is way around this to be honest and I realise it's a fringe case but thought I'd add this incase other people are tearing their hair out over it.

I'm using 1Password (https://agilebits.com/onepassword) for Mac which has a set of browser extensions/add-ons.

When using Middleman-livereload this can produce a javascript error,I think there is a clash going on when 1password tries to inject its own javascript into the page.

Typical error:

Uncaught TypeError: Cannot read property 'form' of undefined (end.min.js:10 which is: chrome-extension://gkndfifopckmhdkohjeoljlbfnjhekfg/data/src/end.min.js)

The error only seems to happen when clicking links with Javascript events attached to them or when interacting with forms.

Disabling the 1password extension seems to fix things. Like I say, just incase somebody else is wondering what's going on here.

Gemspec can't use Middleman-Core Edge

I don't know whether that's intentional or not, but

Bundler could not find compatible versions for gem "middleman-core":
  In Gemfile:
    middleman-livereload (>= 3.0) ruby depends on
      middleman-core (~> 3.0.0) ruby

    middleman (>= 0) ruby depends on
      middleman-core (3.1.0.alpha.1)

Backtrace: http_parser load error

== The Middleman is loading
C:/Ruby200/lib/ruby/gems/2.0.0/gems/http_parser.rb-0.5.3-x86-mingw32/lib/ruby_ht
tp_parser.rb:2:in `require': cannot load such file -- 2.0/ruby_http_parser (Load
Error)
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/http_parser.rb-0.5.3-x86-mingw3
2/lib/ruby_http_parser.rb:2:in `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/http_parser.rb-0.5.3-x86-mingw3
2/lib/http_parser.rb:2:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/http_parser.rb-0.5.3-x86-mingw3
2/lib/http_parser.rb:2:in `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/http_parser.rb-0.5.3-x86-mingw3
2/lib/http/parser.rb:1:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/http_parser.rb-0.5.3-x86-mingw3
2/lib/http/parser.rb:1:in `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-webso
cket/handshake.rb:1:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-webso
cket/handshake.rb:1:in `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-webso
cket.rb:15:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-webso
cket.rb:15:in `block in <top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-webso
cket.rb:14:in `each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-webso
cket.rb:14:in `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/
middleman-livereload/reactor.rb:1:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/
middleman-livereload/reactor.rb:1:in `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/
middleman-livereload/extension_3_1.rb:2:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/
middleman-livereload/extension_3_1.rb:2:in `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/
middleman-livereload.rb:6:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/
middleman-livereload.rb:6:in `block in <top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-core-3.2.1/lib/middle
man-core/extensions.rb:46:in `call'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-core-3.2.1/lib/middle
man-core/extensions.rb:46:in `load'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/middleman-core-3.2.1/lib/middle
man-core/core_extensions/extensions.rb:103:in `activate'

Windows 7, Ruby 2.0.0, Middleman 3.2.1, activate :livereload in config.rb.

Update: Found same issue on guard-livereload
guard/guard-livereload#69

Update 2:
This issue seems to be a duplicate of #34

Update 3:
Completely solved this issue by adding gem 'em-websocket', github: 'igrigorik/em-websocket' to my gemfile as shown in #34

Suggest adding this notice in the readme.md, as em-websocket hasn't been patched for 9 months and latest release was 11 months ago. I can confirm Ruby 2.0.0 is fine, no need to downgrade if em-websocket is fixed.

Update 4:
If I remove require 'em-websocket' from line 1 of middleman-livereload\reactor.rb it has seemingly no effect, this fix was apparently used in the guard-livereload issue above. Not sure what to make of that.

Slow server response time when livereload is activated

Hi,

I'm sorry in advance if I'm doing something completely wrong.

I'm having an issue with middleman-livereload. Whenever I have livereload activated, I'm getting slow server response times. Below is a screenshot of Chrome Dev Tools Network Panel after a manual refresh of a new Middleman project. There's no custom template - the only thing I changed was un-commenting livereload in config.rb.

https://imgur.com/ZUbwwNH

It's an issue that only arises when I have livereload active.

I'm happy to supply you with more info if necessary.

Middleman version: 3.3.3
Middleman-livereload: 3.1.0
Windows 7
tested on Chrome: 36.0.1985.32 beta-m and on Firefox

Thanks in advance

Passing paths or urls?

I am not familiar to livereload in general, but reading the code it seems that what is sent through the websocket is sometimes a file path, sometimes an url.
Since the reloading means refresh urls, i would think that the correct thing to pass is an url.
Am i wrong? Can anyone clarify on this (or give a pointer to readings)? Thank you.

livereload port not passing through correctly to rack-livereload?

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:

jacquescrocker@4125b4a

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

livereload stops working after preview server reloads due to change to a ruby file

After config.rb or a ruby file in helpers/ or lib/ is edited preview server reloads and reinitializes livereload extension. The new livereload instance is disconnected from the browser because it is created fresh, so reloading breaks right away. Refreshing the browser however doesn't fix livereload functionality: the watcher notices file changes all right, but it doesn't communicate them to the browser.

If I'm not mistaken the original "reactor" thread never gets killed and still receives requests from the browser and maintains the list of sockets. The extension however attempts to use a freshly created instance, which never gets connected to the browser and thinks it has nothing to do.

The most seamless solution would be to keep the reactor thread around across server reloads. As far as I can see it should be indifferent to the changes in the config.rb or other custom ruby code, except perhaps enabling / disabling livereload - but even then keeping the reactor thread with livereload watcher switched off shouldn't be any harm. I'll try to come up with some solution.

Middleman eventmachine issue on Windows 7-64?

Hi, I have a problem running middleman-livereload on Windows 7-64bit with

d:\myWebsites\Middleman_test>ruby -v
ruby 2.0.0p247 (2013-06-27) [x64-mingw32]

My gemfile looks like

# If you have OpenSSL installed, we recommend updating
# the following line to use "https"
source 'http://rubygems.org'

gem "middleman", "~>3.1.3"

# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"

# For faster file watcher updates: # Windows
gem "wdm", "~> 0.1.0"  # Windows

# Cross-templating language block fix for Ruby 1.8
platforms :mri_18 do
  gem "ruby18_source_location"
end

It installs perfectly:

d:\myWebsites\Middleman_test>bundle install
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Using i18n (0.6.4)
Using multi_json (1.7.7)
Using activesupport (3.2.12)
Using bundler (1.3.5)
Using chunky_png (1.2.8)
Using coffee-script-source (1.6.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using fssm (0.2.10)
Using sass (3.2.9)
Using compass (0.12.2)
Using em-websocket (0.5.0)
Using tilt (1.3.7)
Using haml (4.0.3)
Using hike (1.2.3)
Using kramdown (1.0.2)
Using rb-fsevent (0.9.3)
Using rb-inotify (0.9.0)
Using rb-kqueue (0.2.0)
Using listen (1.2.2)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using thor (0.18.1)
Using middleman-core (3.1.3)
Using middleman-more (3.1.3)
Using sprockets (2.10.0)
Using sprockets-helpers (1.0.1)
Using sprockets-sass (1.0.1)
Using middleman-sprockets (3.1.2)
Using uglifier (2.1.2)
Using middleman (3.1.3)
Using rack-livereload (0.3.15)
Using middleman-livereload (3.1.0)
Using wdm (0.1.0)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

With

# Reload the browser automatically whenever files change
# activate :livereload

the

bundle exec middleman server 

runs perfectly. However, with

# Reload the browser automatically whenever files change
activate :livereload

suddenly, I get the following errors:

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-websocket.rb:3:in `require': cannot   load such file -- eventmachine (LoadError)
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/em-websocket-0.5.0/lib/em-websocket.rb:3:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/middleman-livereload/reactor.rb:1:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/middleman-livereload/reactor.rb:1:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/middleman-livereload/extension_3_1.rb:2:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/middleman-livereload/extension_3_1.rb:2:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/middleman-livereload.rb:6:in `require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-livereload-3.1.0/lib/middleman-livereload.rb:6:in `block in <top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/extensions.rb:46:in `call'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/extensions.rb:46:in `load'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/core_extensions/extensions.rb:103:in `activate'
from d:/myWebsites/Middleman_test/config.rb:39:in `initialize'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/core_extensions/extensions.rb:162:in `instance_eval'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/core_extensions/extensions.rb:162:in `initialize'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/core_extensions/data.rb:35:in `initialize'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/application.rb:169:in `initialize'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/core_extensions/request.rb:49:in `new'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/core_extensions/request.rb:49:in `inst'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/preview_server.rb:89:in `new_app'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/preview_server.rb:171:in `mount_instance'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/preview_server.rb:20:in `start'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/cli/server.rb:73:in `server'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/cli.rb:77:in `method_missing'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:29:in `run'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:128:in `run'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/lib/middleman-core/cli.rb:22:in `start'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/middleman-core-3.1.3/bin/middleman:18:in `<top (required)>'
from C:/Ruby200-x64/bin/middleman:23:in `load'
from C:/Ruby200-x64/bin/middleman:23:in `<main>'

Can you help?
Also, but I am not sure if it's relevant

middleman init --help

produces

WARN: Unresolved specs during Gem::Specification.reset:
      activesupport (~> 3.2.6)
      i18n (~> 0.6.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.

Thanks a lot!

Reload page when changed file from :js_assets_paths

Hello

I have middleman project where I use some shared files. Directory looks like this

/pages
  /example.com
    config.ru
  /example2.com
  /shared
    file.js.coffee

example.com/config.ru -> https://gist.github.com/5653c0e48931225c6068

Because I added /pages/shared to sprockets paths I can use file.js.coffee inside example.com/source/javascripts/all.js like this

https://gist.github.com/34f118fd94cff586fbfa

When I'm saving all.js middleman-livereload correctly refresh my browser but when I changing file.js.coffee nothing happend.

live reload less import changes?

i have a bunch of less files being imported to my main less file which is being included in the layout.

unfortunately when making changes within the imports the main file doesn't get recompiled and then reloaded. i have to manually make some sort of modification within the main less file for it to change.

any solution to this?

LoadError

This may not be an issue, just my lack of familiarity with the new Middleman 3 setup with Live Reload but I've installed the latest Middleman Gem (3.0.0) with RVM and Ruby 1.9.3-p194. I'm running OS X Lion (10.7.4) on a Mac. I've followed the instructions for the new Middleman-livereload gem and installed that:

gem install middleman-livereload

It shows up in my list of gems as 0.2.2.

I've added this line to my config.rb file:

activate :livereload

And this line to my Gemfile:

gem "middleman-livereload"

I initialise the middleman server from the command line:

bundle exec middleman server

But get the following error:

→ bundle exec middleman server
/Users/username/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:74:in `require': cannot load such file -- middleman/livereload (LoadError)`

Is there something I'm missing there or is there a problem with the livereload gem?

Multiple livereload scripts added

Hello,

I've a project that I've created since a while and using livereload adds a

  <script type="text/javascript">
    WEB_SOCKET_SWF_LOCATION = "/__rack/WebSocketMain.swf";

  </script>
  <script type="text/javascript" src="/__rack/swfobject.js"></script>
  <script type="text/javascript" src="/__rack/web_socket.js"></script>

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

every time I reload the page, what could be the problem? I see it doesn't happens on brand new project but I've no idea what could cause the problem on my project.

No README?

Would help to have some basic instructions. I cant seem to get it working.

  1. Added middleman-livereload to my gemfile
  2. bundle install
  3. Boot middleman server
  4. Nothing.

I even tried using my own Guardfile:

guard 'livereload' do
  watch(%r{source/.+\.(erb|haml|slim)})
  watch(%r{source/shared/.+\.(erb|haml|slim)})
  watch(%r{source/stylesheets/.+\.(scss|sass)})
  watch(%r{source/javascripts/.+\.(js|coffee)})
end

Then ran bundle exec guard and all I get is:

Guard is now watching at '/Users/homebass/Desktop/Code/middleman/generic_board_mockup'
LiveReload 1.6 is waiting for a browser to connect.

No matter how many times i refresh the browser (Chrome or Firefox with lifereload add-on) the connection is not made.

Any tips?

SocketError with MM 3.0.14 and MM-LR 3.1.0

I apologize if this has been addressed somewhere else, but I've been having this error for a while and have been just working around it. More frustrating is that it is occurring on only one of two environments that are essentially the same. Posting here instead of the forums just in case, but will cross-post there.

Whenever I activate Middleman-Livereload, I always recieve the following error, even with fresh gemsets:

SocketError at /
getaddrinfo: nodename nor servname provided, or not known

Ruby    $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb: in initialize, line 762
Web GET 127.0.0.1/

In the terminal:

#<SocketError: getaddrinfo: nodename nor servname provided, or not known>
SocketError: getaddrinfo: nodename nor servname provided, or not known
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `initialize'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `open'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `connect'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744:in `start'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1284:in `request'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1264:in `send_request'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload/body_processor.rb:46:in `use_vendored?'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload/body_processor.rb:97:in `livereload_source'
  (erb):14:in `block (2 levels) in process!'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/erb.rb:838:in `eval'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/erb.rb:838:in `result'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload/body_processor.rb:74:in `block (2 levels) in process!'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload/body_processor.rb:74:in `gsub!'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload/body_processor.rb:74:in `block in process!'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload/body_processor.rb:72:in `each'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload/body_processor.rb:72:in `process!'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload.rb:28:in `_call'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-livereload-0.3.14/lib/rack/livereload.rb:14:in `call'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-1.4.5/lib/rack/showexceptions.rb:24:in `call'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
  $/.rvm/gems/ruby-1.9.3-p194@thinktank/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  $/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Gemfile:

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (3.2.13)
      i18n (= 0.6.1)
      multi_json (~> 1.0)
    chunky_png (1.2.8)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.3.3)
    compass (0.12.2)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.1)
    em-websocket (0.5.0)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.5.3)
    eventmachine (1.0.3)
    execjs (1.4.0)
      multi_json (~> 1.0)
    favicon_maker (0.2.1)
      mini_magick (~> 3.5)
    fssm (0.2.10)
    haml (4.0.3)
      tilt
    hike (1.2.2)
    http_parser.rb (0.5.3)
    http_router (0.10.2)
      rack (>= 1.0.0)
      url_mount (~> 0.2.1)
    i18n (0.6.1)
    listen (0.7.3)
    maruku (0.6.1)
      syntax (>= 1.0.0)
    middleman (3.0.14)
      middleman-core (= 3.0.14)
      middleman-more (= 3.0.14)
      middleman-sprockets (~> 3.1.0)
    middleman-core (3.0.14)
      activesupport (~> 3.2.6)
      bundler (~> 1.1)
      listen (~> 0.7.3)
      rack (~> 1.4.1)
      rack-test (~> 0.6.1)
      rb-fsevent (~> 0.9.3)
      thor (~> 0.15.4)
      tilt (~> 1.3.6)
    middleman-favicon-maker (3.2)
      favicon_maker (~> 0.2.0)
      middleman-core (>= 3.0.0)
    middleman-livereload (3.1.0)
      em-websocket (>= 0.2.0)
      middleman-core (>= 3.0.2)
      multi_json (~> 1.0)
      rack-livereload
    middleman-more (3.0.14)
      coffee-script (~> 2.2.0)
      coffee-script-source (~> 1.3.3)
      compass (>= 0.12.2)
      execjs (~> 1.4.0)
      haml (>= 3.1.6)
      i18n (~> 0.6.0, < 0.6.2)
      maruku (~> 0.6.0)
      middleman-core (= 3.0.14)
      padrino-helpers (= 0.10.7)
      sass (>= 3.1.20)
      uglifier (~> 1.2.6)
    middleman-sprockets (3.1.1)
      middleman-core (>= 3.0.14)
      padrino-helpers (= 0.10.7)
      sprockets (~> 2.1)
      sprockets-helpers (~> 1.0.0)
      sprockets-sass (~> 1.0.0)
    mini_magick (3.6.0)
      subexec (~> 0.2.1)
    multi_json (1.7.3)
    padrino-core (0.10.7)
      activesupport (~> 3.2.0)
      http_router (~> 0.10.2)
      sinatra (~> 1.3.1)
      thor (~> 0.15.2)
      tilt (~> 1.3.0)
    padrino-helpers (0.10.7)
      i18n (~> 0.6)
      padrino-core (= 0.10.7)
    rack (1.4.5)
    rack-livereload (0.3.14)
      rack
    rack-protection (1.5.0)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rb-fsevent (0.9.3)
    redcarpet (3.0.0)
    sass (3.2.9)
    sinatra (1.3.6)
      rack (~> 1.4)
      rack-protection (~> 1.3)
      tilt (~> 1.3, >= 1.3.3)
    sprockets (2.9.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-helpers (1.0.1)
      sprockets (~> 2.0)
    sprockets-sass (1.0.1)
      sprockets (~> 2.0)
      tilt (~> 1.1)
    subexec (0.2.3)
    susy (1.0.8)
      compass (>= 0.12.2)
      sass (>= 3.2.0)
    syntax (1.0.0)
    thor (0.15.4)
    tilt (1.3.7)
    uglifier (1.2.7)
      execjs (>= 0.3.0)
      multi_json (~> 1.3)
    url_mount (0.2.1)
      rack

PLATFORMS
  ruby

DEPENDENCIES
  middleman (~> 3.0.5)
  middleman-favicon-maker
  middleman-livereload
  redcarpet
  susy (~> 1.0.5)

Any help is really welcome - I have gone down a ton of paths to try and figure this out. I can also provide any additional details.

middleman-livereload edge has dependency issue with middleman edge

This happens:

Bundler could not find compatible versions for gem "middleman-core":
  In Gemfile:
    middleman-livereload (>= 0) ruby depends on
      middleman-core (~> 3.2) ruby

    middleman (>= 0) ruby depends on
      middleman-core (4.0.0.pre.0)

I take it that's not good? Unsure, naturally.

James

reload page whenever data/*.yml file is changed

The extension detects the change but doesn't auto-reload the web page. Since the extension doesn't know if current page is using something from data/ directory or not, I'd suggest to always reload the page.

Changed! data/nav.yml
== LiveReloading path: /home/nowaker/projekty/ruby/virtkick-website/data/nav.yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.