johnbintz/rack-livereload

New Guard LiveReload User Confusion (How do I enable this?)

Closed this issue · 3 comments

Drupal themer coming from a sass/compass background. I am familiar with config.rb files and that's about it, when it comes to ruby.

I have my guard and guard-livereload working just fine, but trying to move onto getting rack-livereload functionality as I definitely use it on other devices by accessing my local server via port numbers for testing sites on other devices (A combination of my drupal theme and virtualhost setup accomplishes this)

The readme mentions using in Rails and using in Sinatra. These are both foreign to me so I am not sure how I implement this into a standard website project, not even Drupal related.

Do I need to recreate an environment such as config/environments/development.rb?

Do I need to modify my Gemfile to include rack-livereload?

I have disabled my chrome extension browser and have turned off my LiveReload application, just relying on the Guard LiveReload for now.

When I run "Guard", it just says "LiveReload waiting for browser connect."

I am not sure if I ma missing anything from the instructions (such as a command, file name or perhaps I just don't understand). Please let me know if I am missing something obvious or if more information about my setup is required.

Thanks in advance.

edit: Also forgot to mention, the config.rb file I have is used with the Drupal theme, so I will still be needing it. I am not sure if this creates conflict somehow.

rack-livereload is used solely for automatically injecting the standard LiveReload JavaScript tags into the output HTML of requests made to a Ruby application that uses what's known as Rack, a system for processing HTTP requests and responses in a standard, chaninable way. It doesn't have anything to do with Compass, so that config.rb file you have isn't involved with this setup. rack-livereload sits near the top of this stack, so that when an HTML response is sent from, say, Rails, rack-livereload gets to process it before it is finally delivered to the end user.

None of this applies, however, if you're not using something that speaks Rack, like Drupal. What you need to do is install the LiveReload Drupal module into the copy of Drupal you're developing your theme on. That should act very similarly to how rack-livereload works, injecting the JavaScript tags into your code so your browser and guard-livereload know what to connect to.

After a quick browse of the module code, it appears that you can get that multi-device load functionality with the Drupal module in much the same way as rack-livereload. Make sure both the port that Drupal is running on (say, 3000) and the LiveReload port (assuming you're running both on the same machine) are accessible from outside of your machine (say, on a local network, at 192.168.0.1) and then, with your other devices, connect to the Drupal site running on that machine (http://192.168.0.1:3000/). The browser should automatically try to connect to guard-livereload running on the same machine (ws://192.168.0.1:35729/) and you should be good to go.

If any of this isn't clear, let me know. If it doesn't work, and it's related to how Drupal embeds the script tags or any other thing in its configuration, sadly you'll have to ask elsewhere, as my knowledge of Drupal is non-existent at best.

Thanks for explaining all of that, I appreciate it.

Your third paragraph definitely explains the setup that I currently using pretty much, minus the module. My theme has an option to do that instead of using the module, so it looks like things should work, as your explanation looks pretty bang on.

I'll try the combination of guard-livereload and my Drupal theme livereload injection option and see if it works cross-device.

Thanks again for explaining everything even though I can't use Rack LiveReload!

You're welcome, happy to help!