Comments (12)
With rack-livereload
you need to set the host, like that:
guard :livereload, host: 'myapp.dev' do
....
end
Have you already tried that?
from guard-livereload.
Can you give your Guardfile please? And be sure to use last version of Guard / Guard::LiveReload.
from guard-livereload.
I've done a bundle update, no new Guard/LiveReload to update to, here is the full (rather long) Guardfile, which works 100%, except for the LiveReload part:
I start Guard using bundle exec guard -g misc
group 'misc' do
guard 'rocco', run_on: [:change], dir: 'doc', stylesheet: 'http://jashkenas.github.com/docco/resources/docco.css' do
watch(%r{^app/.*\.(rb|coffee)$})
watch(%r{^lib/.*\.rb$})
end
#guard 'annotate', notify: false, position: 'before', routes: false, tests: false, run_on_start: false, run_on_reload: false do
# watch('db/schema.rb')
# watch('app/models/**/*.rb')
#end
guard 'bundler', notify: false do
watch('Gemfile')
end
guard 'pow', cli: '--notify false', restart_on_start: true, restart_on_reload: false do
watch('.powrc')
watch('.powenv')
watch('.rvmrc')
watch('Gemfile')
watch('Gemfile.lock')
watch('config/**/*.rb')
watch('lib/routes/**/*.rb')
end
guard 'livereload' do
watch(%r{app/.+\.(erb|haml)})
watch(%r{app/helpers/.+\.rb})
watch(%r{(public/|app/assets).+\.(css|js|html)})
watch(%r{(app/assets/.+\.css)\.s[ac]ss}) { |m| m[1] }
watch(%r{(app/assets/.+\.js)\.coffee}) { |m| m[1] }
watch(%r{config/locales/.+\.yml})
end
end
group 'testing' do
guard 'spork' do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.*\.rb$})
watch(%r{^config/initializers/.*\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch(%r{features/support/}) { :cucumber }
end
guard 'rails-assets', run_on: :change, runner: :cli, rails_env: 'test' do
watch(%r{^app/assets/.+$})
end
guard 'rspec', cli: '--drb --color --fail-fast --format progress', all_after_pass: true, all_on_start: true do
watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
end
guard 'cucumber', cli: "--drb --no-profile --no-snippets --color --strict --format pretty", run_all: { cli: "--format progress" } do
watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { 'features' }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end
#guard 'jasmine-headless-webkit', all_on_start: false, full_run: true do
# watch(%r{^public/assets-test/.*\.js})
# watch(%r{^app/assets/javascripts/(.*)\..*}) { |m| newest_js_file("spec/javascripts/#{m[1]}_spec") }
# watch(%r{^app/views/.*\.jst$})
#end
end
#group 'dependencies' do
#
# guard 'shell' do
# dependencies = '~/Jean/dependencies/'
#
# watch(%r{backbone-forms/src/(backbone\-forms\.js)}) {|m| `cp #{dependencies + m[0]} vendor/assets/javascripts/#{m[1]}` }
# end
#
#end
from guard-livereload.
I did, and I just tested it again, just to be thorough:
- I closed down pow using
powder down
- I quit all my browsers
- I stopped the Guard from running
- I made sure my
Guardfile
said:
guard 'livereload', host: 'myapp.dev' do
...
end
- I made sure my
development.rb
said:
MyApp::Application.configure do
# livereload
config.middleware.insert_before(
Rack::Lock, Rack::LiveReload,
:host => 'myapp.dev'
)
end
- I restarted pow using
powder up
- I restarted the Guard using
bundle exec guard -g misc
- I checked the terminal to see if the livereload port was being used, and it was:
$ lsof -i | grep 35729
ruby 12341 Jean 12u IPv4 0xffffff802633ec00 0t0 TCP localhost:35729 (LISTEN)
- I tried changing public/index.html and was notified that the change was being pushed through livereload
- no changes where displayed in the browsers
- also, bypassing rack-livereload and using the browser plugins, same result
from guard-livereload.
hmm, if I start livereload with the livereload
command, I get the following error:
LiveReload is waiting for browser to connect.
/Users/Jean/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- osx/foundation (LoadError)
From googling, it seems this is tied to not using the default ruby on OS X but using rvm (which I am, using 1.9.3). But I don't expect you to use the system ruby, do you?
from guard-livereload.
Try also to remove the host config on the middleware, I have:
config.middleware.insert_before Rack::Lock, Rack::LiveReload
What kind of JS error do you have in your browser? Normally it should tell that it can't connect to the livereload server via websocket.
from guard-livereload.
Sure I use 1.9.3 too. Starting livereload
with the command use RubyCocoa and has nothing to do with Guard (that use rb-fsevent on OS X). Can you give your Gemfile too?
from guard-livereload.
I changed development.rb
, but nothing changed.
I don't get any JS errors in the browser. No JS is injected in the head (using the inspector)
here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.0.rc2'
# server
gem 'thin'
gem 'foreman'
gem 'heroku'
# database
gem 'pg'
# authentication
gem 'devise', '~> 2.0.0.rc'
gem 'bcrypt-ruby', '~> 3.0.0'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.0'
gem 'haml_coffee_assets'
gem 'uglifier', '>= 1.0.3'
gem 'compass', '~> 0.12.alpha'
end
# templates, etc
gem 'less', path: '~/Github/less.rb' #see: https://github.com/cowboyd/less.rb/issues/17
gem 'jquery-rails'
gem 'haml-rails'
gem 'simple_form'
gem 'backbone-on-rails', path: '~/Github/backbone-on-rails'
gem 'backbone-support'
group :development do
gem 'rails3-generators'
gem 'letter_opener'
gem 'guard-annotate'
gem 'guard-bundler'
gem 'rack-livereload'
gem 'guard-livereload'
gem 'guard-pow'
gem 'guard-spork'
gem 'ruby_gntp'
gem 'rocco', git: 'https://github.com/rtomayko/rocco'
gem 'guard-rocco'
gem 'pry-rails'
gem 'pry-doc'
gem 'pry-remote'
gem 'hirb'
end
gem 'rspec-rails', group: [:test, :development]
group :test do
gem 'spork', '~> 0.9.0.rc'
gem 'cucumber-rails'
gem 'rspec-instafail'
gem 'shoulda-matchers'
gem 'timecop'
gem 'factory_girl_rails'
gem 'database_cleaner'
gem 'capybara-webkit'
gem 'guard-rspec'
gem 'guard-cucumber'
gem 'guard-rails-assets'
gem 'simplecov', require: false
end
from guard-livereload.
After reading your comment about rb-fsevent, I noticed I don't have that gem in my Gemfile. Although I did read somewhere this was no longer needed (for the latest Guard, or the latest Rails or something), but I added it back, and now it seems to work.
The rack-livereload doesn't work though, I have to manually enable the browser plugin for it to pick up the changes. Also, it only seems to work in Safari, but I've read another issue here that said the same, so I might not be alone in that.
from guard-livereload.
Hmm rack-livereload
works great for us, feel free to open a issue there.
from guard-livereload.
same problem. rack-livereload has issues with Rails 3.2 and not using browser plugins ... any solutions?
from guard-livereload.
+1
I managed to solve this in the same fashion. Getting the chrome livereload extension online solved the problem. It is not working with rack-livereload. But that isnt too much of a problem since most of my dev work is done in chrome..
I'm using guard and rails 4.0 on OSX 10.8.4 .. will try rack-livereload again in OSX mavericks and see if anything changed.
from guard-livereload.
Related Issues (20)
- Security Vulnerability - possible to read arbitrary files via socket HOT 2
- CSS refresh then reload HOT 6
- Not reloading CSS correctly with config.assets.debug = false HOT 8
- Error installing guard-livereload
- Where is the package located? HOT 5
- not compatible with ruby-2.3.3 and Rails 5.0.0.1 HOT 1
- Not working with Ruby 2.4.0 and Rails 5.0.1 HOT 2
- guard livereload using ipv4 only . how to force to use ipv6. HOT 1
- Hangs when retrieving livereload.js
- Cannot init or load guard-livereload on Ruby 2.4.1/Windows HOT 4
- Could not find eventmachine-1.2.5 in any of the sources HOT 1
- "no acceptor" rspec error HOT 3
- Error "Could not parse data entirely (0 != 609) (HTTP::Parser::Error)" HOT 4
- Wiki page dead links: Usage::2. Adding a snippet to your web page HOT 2
- undefined method `epoll?' for EventMachine
- there is no add-ons' URL link of FireFox. HOT 1
- No such file or directory -- /usr/lib/ruby/vendor_ruby/guard/_guard-core
- guard-livereload reports with undefined method epoll? error HOT 5
- CSS edits lose styling after reload HOT 3
- Rails 7.0.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guard-livereload.