From b5f3d35a943c558b8c86bd9bdfe204f4eea4987e Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Mon, 7 Jul 2014 12:19:15 +0200 Subject: [PATCH] add live reload http://blog.55minutes.com/2013/01/lightning-fast-sass-reloading-in-rails-32/ --- Gemfile | 6 ++++++ Guardfile | 11 +++++++++++ config/environments/development.rb | 7 +++++++ 3 files changed, 24 insertions(+) create mode 100644 Guardfile diff --git a/Gemfile b/Gemfile index bbecda35e..86b6b52e9 100644 --- a/Gemfile +++ b/Gemfile @@ -85,6 +85,12 @@ group :development, :test do # rest client lib for unit tests gem 'faraday' + # livereload on template changes (html, js, css) + gem 'guard', '>= 2.2.2', :require => false + gem 'guard-livereload', :require => false + gem 'rack-livereload' + gem 'rb-fsevent', :require => false + # websocket unit tests # gem 'em-websocket-client' end diff --git a/Guardfile b/Guardfile new file mode 100644 index 000000000..180e51f47 --- /dev/null +++ b/Guardfile @@ -0,0 +1,11 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +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))).*}) { |m| "/assets/#{m[3]}" } +end diff --git a/config/environments/development.rb b/config/environments/development.rb index 32a81aad6..000009e02 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -30,4 +30,11 @@ Zammad::Application.configure do # Expands the lines which load the assets config.assets.debug = true + # Automatically inject JavaScript needed for LiveReload + config.middleware.use(Rack::LiveReload, + :min_delay => 500, # default 1000 + :max_delay => 10_000, # default 60_000 + :live_reload_port => 67789, # default 35729 + :source => :vendored + ) end