automatically reload your browser when 'view' files are modified (VERY ALPHA)
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/guard
spec
.gitignore
.rvmrc
.travis.yml
Gemfile
Guardfile
LICENSE
README.rdoc
Rakefile
guard-autorefresh.gemspec

README.rdoc

WARNING

This is alpha. On one hand, it has a dependency on “watchr”, which is not used but is required by autorefresh :( On the other hand, it is slow and I suspect there is flaw in the way the pusher socket is used …

Guard::Autorefresh

Autorefresh guard allows to automatically reload your browser when 'view' files are modified.

It is using logankoester / autorefresh to do its job.

No need for a browser extension, it just works.

I wrote it in 3 pomodori as I could not make guard-livereload work on my machine and I did not want to bother installing an extension.

Install

Please be sure to have Guard installed before continue.

Install the gem:

gem install guard-autorefresh

Add it to your Gemfile (inside development group):

gem 'guard-autorefresh'

Add guard definition to your Guardfile by running this command:

guard init autorefresh

Add autorefresh socket setup to your layout files:

<head>
    <%= AutoRefresh.channel('my_awesome_app') if Rails.env.development? %>
</head>

Do not rename 'my_awesome_app', your app must be awesome and it is hardcoded inside the library.

Usage

Please read Guard usage doc

Guardfile

You can adapt your 'view' files like you want. Please read Guard doc for more info about Guardfile DSL.

guard 'autorefresh' do
  watch(%r{app/.+\.(erb|haml)})
  watch(%r{app/helpers/.+\.rb})
  watch(%r{(public/|app/assets).+\.(css|js|html)})
  watch(%r{(app/assets/.+\.css)\.scss}) { |m| m[1] }
  watch(%r{(app/assets/.+\.js)\.coffee}) { |m| m[1] }
  watch(%r{config/locales/.+\.yml})
end

Development

Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.

TODO

  • autorefresh has a dependency on watchr :(

  • travis CI ;)

Authors

Jean-Michel Garnier