Skip to content

Instantly share code, notes, and snippets.

@dcadenas
Last active December 23, 2015 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcadenas/6617887 to your computer and use it in GitHub Desktop.
Save dcadenas/6617887 to your computer and use it in GitHub Desktop.
Poor man's livereload for Mac + Chrome
require 'guard'
require 'guard/guard'
module ::Guard
class Reload < Guard
def initialize(*args, &block)
super
@script = <<-APPLESCRIPT
tell window 1 of application "Google Chrome"
tell tab -1
execute javascript "window.location.reload()"
end tell
end tell
APPLESCRIPT
end
def run_on_modifications(paths)
`osascript -e '#{@script}'`
end
end
end
guard 'reload' do
watch(/.*/)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment