Download & Extend

LiveReload not working

Project:Omega
Version:7.x-4.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I have omega guard installed and watching scss files -- but I am getting no love from livereload?

~/d7dev/sites/default$ drush omega-guard omg4
Compilation took 0.013s
16:16:04 - INFO - Guard::Compass is watching at your stylesheets.
16:16:05 - INFO - LiveReload 1.6 is waiting for a browser to connect.
16:16:05 - INFO - Guard is now watching at '/home/joe/websites/d7dev/sites/all/themes/omg4'
overwrite css/styles.css
16:17:10 - INFO - Reloading browser: css/styles.css
overwrite css/styles.css
16:18:31 - INFO - Reloading browser: css/styles.css
[1] guard(main)>
I have an apache virtual host d7dev.dev I use to connect to the site on my local - I see the settings in the development tab on the theme settings - reading that screen it seems it should work.

But I don't see that livereload.js is being loaded -

+ // We need to add livereload.js as external script with an absolute path
+ // because otherwise Drupal core messes with the query string.
+ drupal_add_js(url($path . '/js/livereload.js', array('query' => $options, 'absolute' => TRUE)), 'external');
is this pointing to the subtheme or omega base theme? only omega has livereload.js

Comments

#1

One important notice is missing from the guard output:

Compilation took 0.43s
00:12:42 - INFO - Guard::Compass is watching at your stylesheets.
00:12:42 - INFO - LiveReload 1.6 is waiting for a browser to connect.
00:12:42 - INFO - Guard is now watching at '/home/fubhy/Projects/omega/sites/all/themes/omega_subtheme'
<strong>00:12:43 - INFO - Browser connected.</strong>
unchanged sass/hacks.scss
unchanged sass/reset.scss
overwrite css/styles.css
00:12:48 - INFO - Reloading browser: css/styles.css

Note the "Browser connected." message.

Did you read the descriptions in the theme settings for "host" and "port"? Does "d7dev.dev" point to 127.0.0.1 (localhost)? If you are running guard locally but the site points to a virtual machine through that vhost for example you have to specify that the livereload host is "localhost". Otherwise the script tries to connect to d7dev.dev too and, if that runs on a different IP, that won't work. So, make sure that 'host' really points to where the livereload server runs (that would be where you invoked "omega-guard".

Also, before we try that, did you check if "livereload.js" is being added to the page? It should appear in the footer by default. Can you make sure it does in fact get added?

#2

Oh and make sure that you clear the cache after updating Omega 4 so that it can pick up the preprocess function which takes care of loading the .js file (that preprocess function has to be added through hook_theme_registry_alter() first which is only executed on cache clear).

#3

Oh and also please check that "Enable LiveReload" is checked in your theme settings :).

#4

Oh and hit F5 (refresh) once so that the browser reloads and actually gets a chance to connect to the server after running "drush omega-guard". I am sure you did that, but hey, you never know! :)

#5

I just commited http://drupalcode.org/project/omega.git/commit/d1787cb which might solve it for you. There was a weird bug when interactions were enabled... Maybe you were affected by it too.

#6

@fubhy thanks for the excellent follow up on my issue. Following your advice it is now working - and a very cool feature it is.

livereload.js was being loaded - I didn't look in the footer...

The only change I made was add "localhost" to the host setting which I had left blank. It is running local not in a virtual machine.

It even works on two browsers at the same time.... now I can see firefox and chrome both update without leaving my code editor !!!

what other wonders will we find in omega 4 !!!!

#7

Status:active» fixed

Great, setting it to fixed then!

#8

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here