Skip to content
Permalink
Browse files

added LiveReload for development

  • Loading branch information...
Andy Hulme Andy Hulme
Andy Hulme authored and Andy Hulme committed Apr 24, 2019
1 parent 4fb3cce commit add8b04c0da52ce494bfeab31ee6f39f1963a643
Showing with 100 additions and 3 deletions.
  1. +5 −0 Gemfile
  2. +37 −3 Gemfile.lock
  3. +55 −0 Guardfile
  4. +3 −0 config/environments/development.rb
@@ -51,4 +51,9 @@ group :development do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-commands-rspec', group: :development
# LiveReload sass/view changes in th browser
gem 'guard', '~> 2.15'
gem 'guard-livereload', require: false
gem 'rack-livereload'
end

@@ -83,7 +83,11 @@ GEM
declarative-option (0.1.0)
diff-lcs (1.3)
dotenv (2.2.2)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubi (1.7.1)
eventmachine (1.2.7)
execjs (2.7.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
@@ -92,9 +96,8 @@ GEM
railties (>= 3.0.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
feathericon-sass (1.0.0)
sass (>= 3.2)
ffi (1.9.25)
formatador (0.2.5)
github-markdown (0.6.9)
globalid (0.4.1)
activesupport (>= 4.2.0)
@@ -121,12 +124,28 @@ GEM
signet (~> 0.7)
groupdate (4.0.1)
activesupport (>= 4.2)
guard (2.15.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-livereload (2.5.2)
em-websocket (~> 0.5)
guard (~> 2.8)
guard-compat (~> 1.0)
multi_json (~> 1.8)
hashdiff (0.3.7)
hashie (3.5.7)
honeybadger (3.2.0)
html-pipeline (2.7.2)
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.6.0)
httpclient (2.8.3)
hurley (0.2)
i18n (1.2.0)
@@ -137,13 +156,18 @@ GEM
thor (>= 0.14, < 2.0)
jwt (1.5.6)
kgio (2.11.2)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.13)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
@@ -161,12 +185,16 @@ GEM
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nenv (0.3.0)
newrelic_rpm (4.6.0.338)
nio4r (2.3.1)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
nokogumbo (1.5.0)
nokogiri
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oauth2 (1.4.0)
faraday (>= 0.8, < 0.13)
jwt (~> 1.0)
@@ -193,6 +221,8 @@ GEM
byebug (~> 10.0)
pry (~> 0.10)
rack (2.0.6)
rack-livereload (0.3.17)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.2)
@@ -255,6 +285,7 @@ GEM
rspec-support (3.7.1)
ruby-enum (0.7.2)
i18n
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sanitize (4.6.5)
crass (~> 1.0.2)
@@ -283,6 +314,7 @@ GEM
sawyer (0.7.0)
addressable (>= 2.3.5, < 2.5)
faraday (~> 0.8, < 0.10)
shellany (0.0.1)
signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
@@ -340,10 +372,11 @@ DEPENDENCIES
custom_error_message (~> 1.1.1)
dotenv (~> 2.2.1)
factory_bot_rails (~> 4.8.2)
feathericon-sass
github-markdown (~> 0.6.9)
google_drive
groupdate
guard (~> 2.15)
guard-livereload
honeybadger (~> 3.2.0)
html-pipeline (~> 2.7.1)
jquery-rails (~> 4.3.1)
@@ -352,6 +385,7 @@ DEPENDENCIES
omniauth-orcid (~> 2.0.2)
pg (~> 0.21.0)
pry-byebug
rack-livereload
rails (= 5.2.2)
rails-controller-testing (~> 1.0.2)
responders
@@ -0,0 +1,55 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}

## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), then you will want to move
## the Guardfile to a watched dir and symlink it back, e.g.
#
# $ mkdir config
# $ mv Guardfile config/
# $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"

guard 'livereload' do
extensions = {
css: :css,
scss: :css,
sass: :css,
js: :js,
coffee: :js,
html: :html,
png: :png,
gif: :gif,
jpg: :jpg,
jpeg: :jpeg,
# less: :less, # uncomment if you want LESS stylesheets done in browser
}

rails_view_exts = %w(erb haml slim)

# file types LiveReload may optimize refresh for
compiled_exts = extensions.values.uniq
watch(%r{public/.+\.(#{compiled_exts * '|'})})

extensions.each do |ext, type|
watch(%r{
(?:app|vendor)
(?:/assets/\w+/(?<path>[^.]+) # path+base without extension
(?<ext>\.#{ext})) # matching extension (must be first encountered)
(?:\.\w+|$) # other extensions
}x) do |m|
path = m[1]
"/assets/#{path}.#{type}"
end
end

# file needing a full reload of the page anyway
watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$})
watch(%r{app/helpers/.+\.rb})
watch(%r{config/locales/.+\.yml})
end
@@ -40,4 +40,7 @@
# config.action_view.raise_on_missing_translations = true

config.cache_store = :memory_store

# Automatically inject JavaScript needed for LiveReload
config.middleware.insert_after(ActionDispatch::Static, Rack::LiveReload)
end

0 comments on commit add8b04

Please sign in to comment.
You can’t perform that action at this time.