Skip to content
Go to file
Cannot retrieve contributors at this time
51 lines (33 sloc) 1.46 KB


rack-weinre is a rack middleware, which inserts a script tag that loads weinre target script file into your text/html pages.


First, add to your Gemfile:

gem 'rack-weinre'

then bundle as usual.

with Rails

in config/environments/development.rb:

MyApp::Application.configure do
  config.middleware.use 'Rack::Weinre'


use Rack::Weinre

How it works

Once enabled (see below), it inserts a script tag just before the closing head tag of your html pages. the tag is something like:

<script src="http://localhost:8080/target/target-script-min.js#anonymous"></script>

but the host name depends on to which host the request was made.



you may use a port number other than 8080, say, 9090. :port option will come in handy then.

use Rack::Weinre, :port => 9090

Toggle tag

if you give a :switch option, it is considered as a file name in a relative path from the working rack application. in that case, rake-weinre is active only when the file exists at the exact path.

use Rack::Weinre, :switch => 'file'  # inserts tag if the file exists (relative)

it is always active when no :switch option is given.


Copyright © 2012 Hiroki Yoshioka. See MIT-LICENSE for further details.

You can’t perform that action at this time.