Skip to content

Instantly share code, notes, and snippets.

@sebastiangeiger
Created November 18, 2014 21:43
Show Gist options
  • Save sebastiangeiger/258dd4c2e958233fec55 to your computer and use it in GitHub Desktop.
Save sebastiangeiger/258dd4c2e958233fec55 to your computer and use it in GitHub Desktop.
commit ec5b2a7ca39e3b547b0fb086aeb80145d182c767
Author: Sebastian Geiger <sebastian@bignerdranch.com>
Date: Tue Nov 18 13:36:49 2014 -0500
Adding guard-livereload
Because I don't want to do frontend work without it
diff --git a/Gemfile b/Gemfile
index 86d01d0..d6113df 100644
--- a/Gemfile
+++ b/Gemfile
@@ -40,6 +40,9 @@ gem 'omniauth-openid'
group :development do
gem 'guard-rspec', require: false
+ gem 'guard-livereload', require: false
+ gem 'rack-livereload'
+ gem 'guard-sass'
gem 'spring-commands-rspec'
gem 'terminal-notifier-guard'
gem 'foreman'
diff --git a/Gemfile.lock b/Gemfile.lock
index deeaae9..7634efa 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -71,7 +71,11 @@ GEM
debugger-linecache (1.2.0)
diff-lcs (1.2.5)
dotenv (1.0.2)
+ em-websocket (0.5.1)
+ eventmachine (>= 0.12.9)
+ http_parser.rb (~> 0.6.0)
erubis (2.7.0)
+ eventmachine (1.0.3)
execjs (2.2.2)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
@@ -95,11 +99,19 @@ GEM
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
+ guard-livereload (2.3.1)
+ em-websocket (~> 0.5)
+ guard (~> 2.0)
+ multi_json (~> 1.8)
guard-rspec (4.2.10)
guard (~> 2.1)
rspec (>= 2.14, < 4.0)
+ guard-sass (1.5.0)
+ guard (>= 1.1.0)
+ sass (>= 3.1)
hashie (3.3.1)
hike (1.2.3)
+ http_parser.rb (0.6.0)
i18n (0.6.11)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
@@ -148,6 +160,8 @@ GEM
pundit (0.3.0)
activesupport (>= 3.0.0)
rack (1.5.2)
+ rack-livereload (0.3.15)
+ rack
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
@@ -277,7 +291,9 @@ DEPENDENCIES
faraday (~> 0.9.x)
faraday-http-cache (~> 0.4.x)
foreman
+ guard-livereload
guard-rspec
+ guard-sass
jquery-rails
lazy_doc (~> 0.4.x)
mysql2
@@ -287,6 +303,7 @@ DEPENDENCIES
poltergeist (~> 1.5.1)
pry-byebug
pundit (~> 0.3.x)
+ rack-livereload
rails (= 4.1.6)
rspec-rails (~> 3.0.0)
sass-rails (~> 4.0.3)
diff --git a/Guardfile b/Guardfile
index 34b18c9..5b0a4e3 100644
--- a/Guardfile
+++ b/Guardfile
@@ -24,3 +24,14 @@ guard :rspec, cmd: 'bundle exec spring rspec' do
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end
+guard 'sass', :input => 'sass', :output => 'css'
+
+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+/(.+\.(scss|css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
+end
+
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 1980962..a5dbc53 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -38,4 +38,8 @@ Rails.application.configure do
# Use forman to stand up the mocked out Dycom Data Service API!
config.dycom_data_service_base_url = 'http://localhost:3001'
+
+
+ # Using Livereload in development mode
+ config.middleware.use Rack::LiveReload
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment