Last active
December 23, 2015 09:59
-
-
Save dcadenas/6617887 to your computer and use it in GitHub Desktop.
Poor man's livereload for Mac + Chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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