Live Reload Za Rails

Live Reload Za Rails

Da li ste ikada želeli da napravite promene u svojoj aplikaciji Rails i odmah vidite promene u pregledaču?

Ako je to slučaj, možete razmisliti o upotrebi funkcije Live Reload Rails .

Instalirajte Live Reload Ubuntu

sudo apt-get install python-livereload

Instalirajte dodatak za Chrome

https://chrome.google.com/webstore/detail/livereload

Enable http fecth in settings

ili Koristite stalak

https://github.com/johnbintz/rack-livereload

Pokrenite ponovno učitavanje

livereload ~/projects/project-name/app

Dodajte guard-livereload

group :development do
  gem 'guard-livereload', require: false
end

Inicijalizujte guard

bungle exec guard init

Dodajte u Guardfile

guard 'livereload' 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|png|jpg|scss))).*}) { |m|     "/assets/#{m[3]}" }
end

Rub guard

bundle exec guard