Skip to content

Instantly share code, notes, and snippets.

@nebirhos
Last active May 19, 2020 10:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nebirhos/7658976 to your computer and use it in GitHub Desktop.
Save nebirhos/7658976 to your computer and use it in GitHub Desktop.
Multi device Guard::LiveReload with Chrome Android

Multi device Guard::LiveReload with Chrome Android

  1. Copy the following Gemfile, Guardfile, config/environments/development.rb, then bundle
  2. Configure your Android devices (see https://developers.google.com/chrome-developer-tools/docs/remote-debugging?hl=it#reverse-port-forwarding)
  3. In Chrome port forwarding settings set two forwards:
    • 8080 => localhost:3000
    • 5729 => localhost:5729
  4. Connect as much Android devices as possible (like this)
  5. Enjoy!

Useful resources

# config/environments/development.rb
MyRailsAwesomeApp::Application.configure do
...
# Automatically inject JavaScript needed for LiveReload
config.middleware.insert_after(ActionDispatch::Static, Rack::LiveReload, live_reload_port: 5729)
end
group :development do
gem 'guard-livereload', require: false
gem 'rack-livereload'
gem 'rb-inotify', require: false # linux
gem 'rb-fsevent', require: false # os x
end
guard 'livereload', port: '5729' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|jpg|png))).*}) { |m| "/assets/#{m[3]}" }
end
@smarquez1
Copy link

This is awesome. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment