{"id":13447617,"url":"https://github.com/johnbintz/rack-livereload","last_synced_at":"2025-03-22T01:31:09.446Z","repository":{"id":1786426,"uuid":"2710298","full_name":"johnbintz/rack-livereload","owner":"johnbintz","description":"https://github.com/onesupercoder/rack-livereload","archived":true,"fork":false,"pushed_at":"2021-07-05T18:46:01.000Z","size":283,"stargazers_count":358,"open_issues_count":15,"forks_count":78,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-28T13:10:45.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"eschwartz/backbone.googlemaps","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnbintz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-04T15:51:49.000Z","updated_at":"2024-10-24T22:53:51.000Z","dependencies_parsed_at":"2022-08-20T11:00:16.488Z","dependency_job_id":null,"html_url":"https://github.com/johnbintz/rack-livereload","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbintz%2Frack-livereload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbintz%2Frack-livereload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbintz%2Frack-livereload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbintz%2Frack-livereload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnbintz","download_url":"https://codeload.github.com/johnbintz/rack-livereload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244893420,"owners_count":20527586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T05:01:22.484Z","updated_at":"2025-03-22T01:31:09.156Z","avatar_url":"https://github.com/johnbintz.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Gems","Middlewares"],"sub_categories":["Rack"],"readme":"# Rack::LiveReload\n\n_This fork is deprecated: Go check out https://github.com/onesupercoder/rack-livereload instead._\n\n\u003ca href=\"http://travis-ci.org/johnbintz/rack-livereload\"\u003e\u003cimg src=\"https://secure.travis-ci.org/johnbintz/rack-livereload.png\" /\u003e\u003c/a\u003e\n[![Code Climate](https://codeclimate.com/github/johnbintz/rack-livereload.png)](https://codeclimate.com/github/johnbintz/rack-livereload)\n\nHey, you've got [LiveReload](http://livereload.com/) in my [Rack](http://rack.rubyforge.org/)!\nNo need for browser extensions anymore! Just plug it in your middleware stack and go!\nEven supports browsers without WebSockets!\n\nUse this with [guard-livereload](http://github.com/guard/guard-livereload) for maximum fun!\n\n## Installation\n\n### Rails\n\nAdd the gem to your Gemfile.\n\n```ruby\ngem \"rack-livereload\", group: :development\n```\n\nThen add the middleware to your Rails middleware stack by editing your `config/environments/development.rb`.\n\n```ruby\n# config/environments/development.rb\n\nMyApp::Application.configure do\n  # Add Rack::LiveReload to the bottom of the middleware stack with the default options:\n  config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload\n\n  # or, if you're using better_errors:\n  config.middleware.insert_before Rack::Lock, Rack::LiveReload\n\n  # ...\nend\n```\n\n#### Tweaking the options\n\n```ruby\n# Specifying Rack::LiveReload options.\nconfig.middleware.use(Rack::LiveReload,\n  min_delay        : 500,    # default 1000\n  max_delay        : 10_000, # default 60_000\n  live_reload_port : 56789,  # default 35729\n  host             : 'myhost.cool.wow',\n  ignore           : [ %r{dont/modify\\.html$} ]\n)\n```\n\nIn addition, Rack::LiveReload's position within middleware stack can be\nspecified by inserting it relative to an exsiting middleware via\n`insert_before` or `insert_after`. See the [Rails on Rack: Adding a\nMiddleware](http://guides.rubyonrails.org/rails_on_rack.html#adding-a-middleware)\nsection for more detail.\n\n### Sinatra / config.ru\n\n``` ruby\nrequire 'rack-livereload'\n\nuse Rack::LiveReload\n# ...or...\nuse Rack::LiveReload, min_delay: 500, ...\n```\n\n## How it works\n\nThe necessary `script` tag to bring in a copy of [livereload.js](https://github.com/livereload/livereload-js) is\ninjected right after the opening `head` tag in any `text/html` pages that come through. The `script` tag is built in\nsuch a way that the `HTTP_HOST` is used as the LiveReload host, so you can connect from external machines (say, to\n`mycomputer:3000` instead of `localhost:3000`) and as long as the LiveReload port is accessible from the external machine,\nyou'll connect and be LiveReloading away!\n\n### Which LiveReload script does it use?\n\n* If you've got a LiveReload watcher running on the same machine as the app that responds\n  to `http://localhost:35729/livereload.js`, that gets used, with the hostname being changed when\n  injected into the HTML page.\n* If you don't, the copy vendored with rack-livereload is used.\n* You can force the use of either one (and save on the cost of checking to see if that file\n  is available) with the middleware option `:source =\u003e :vendored` or `:source =\u003e :livereload`.\n\n### How about non-WebSocket-enabled browsers?\n\nFor browsers that don't support WebSockets, but do support Flash, [web-socket-js](https://github.com/gimite/web-socket-js)\nis loaded. By default, this is done transparently, so you'll get a copy of swfobject.js and web_socket.js loaded even if\nyour browser doesn't need it. The SWF WebSocket implementor won't be loaded unless your browser has no native\nWebSockets support or if you force it in the middleware stack:\n\n``` ruby\nuse Rack::LiveReload, force_swf: true\n```\n\nIf you don't want any of the web-sockets-js code included at all, use the `no_swf` option:\n\n``` ruby\nuse Rack::LiveReload, no_swf: true\n```\n\nOnce more browsers support WebSockets than don't, this option will be reversed and you'll have\nto explicitly include the Flash shim.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbintz%2Frack-livereload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbintz%2Frack-livereload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbintz%2Frack-livereload/lists"}