Giter VIP home page Giter VIP logo

Comments (30)

passy avatar passy commented on August 12, 2024

Yap, independent of OS.

The problem is that the lrSnippet does not get injected, because the middleware is not called. I'm not familiar enough with connect middlewares, but it looks like one of the previous entries in the chains skips it. If you put the lrSnippet at the beginning, it works sometimes but stalls the connection every other request. Don't know if this is our setup or a problem of connect-livereload.

@sindresorhus Any ideas?

from generator-webapp_deprecated.

sindresorhus avatar sindresorhus commented on August 12, 2024

Weird, work perfectly for me every time: https://gist.github.com/sindresorhus/68da2abec3950ae9f5c5

I originally placed it first, but this caused the problem you describe: intesso/connect-livereload#4

Don't really have any idea why it doesn't load.

Anyone have anything to add?

from generator-webapp_deprecated.

addyosmani avatar addyosmani commented on August 12, 2024

Just that it can be reproduced. Does anyone want to take on the task of researching what the issue is more thoroughly?

from generator-webapp_deprecated.

sheenobu avatar sheenobu commented on August 12, 2024

Ah. I believe I have figured out a fix for this issue, though I have not figured out exactly 'why'. I know that the inject method of the connect-livereload middleware is, every other request, getting a string passed to it as undefined. So a fix to make this work is to guard against undefined, and send an empty response.

After this, we get a working livereload snippet sent that properly works and does not lock up every other request.

https://github.com/sheenobu/connect-livereload/commit/9d39716a8ce824fa30468297af2b2ffe87be3ab9

EDIT: looks like I'm mistaken on the 'undefined' string, javascript comparison woes -_-.

from generator-webapp_deprecated.

sheenobu avatar sheenobu commented on August 12, 2024

Oh! I'm learning so much. I've traced the issue to the connect server responding an HTTP 304 response. When this happens, the res.end function is not being called.

Here is the diff and pull request:

https://github.com/sheenobu/connect-livereload/commit/b73c772e262464ddbac24ba3e726757e32c33f44

intesso/connect-livereload#5

from generator-webapp_deprecated.

jetsetter1 avatar jetsetter1 commented on August 12, 2024

I'm still experiencing this issue on a fresh install of Yo v1.0.0-beta5 on Node v0.10.4 (checked and sheenobu's fix is included in connect-livereload). After reading comments here, note that refreshing 'works' consistently with two calls to lrSnippet in Gruntfile.js (though clearly not acceptable) i.e.

livereload: {
    options: {
        middleware: function (connect) {
            return [
                lrSnippet,
                mountFolder(connect, '.tmp'),
                mountFolder(connect, yeomanConfig.app),
                lrSnippet
            ];
        }
    }
}

Might warrant further investigation?

from generator-webapp_deprecated.

addyosmani avatar addyosmani commented on August 12, 2024

Clearly still an issue on our end. I would prefer that we not fix this by calling lnrSnippet multiple times, but we'll continue investigating what the problem is. @jetsetter1 are you also on Windows?

from generator-webapp_deprecated.

sheenobu avatar sheenobu commented on August 12, 2024

Are you using generator-webapp from the github master branch of from the latest release (0.2.2)? The 0.2.2 is still broken as it generates lrSnippet at the end.

If I understand connect middleware, having lrSnippet at the end AND beginning makes no sense. Even having it at the end makes no sense because lrSnippet must run before the connect static middleware sends an HTML body.

from generator-webapp_deprecated.

jetsetter1 avatar jetsetter1 commented on August 12, 2024

I'm on a Mac running 10.8.3. I thought I had pulled the latest generator-webapp but have just generated Grunt.js afresh using the github master branch and all seems good on the live reload front. Sorry for any confusion and thanks for your help.

from generator-webapp_deprecated.

cetchells avatar cetchells commented on August 12, 2024

I have the github master branch (I'm on windows) Checked lrSnippet is at the start.
html files work ok though the reload task gets called twice or thrice? .
I can't get .scss files to fire a reload at all, though the main.css is copied to the .tmp folder.
Is that the expected behaviour? Anyone else on windows confirm this is working?
Maybe I need a fresh copy.

Running "watch" task
... Reload app\index.html ...
... Reload app\index.html ...
... Reload app\index.html ...
Completed in 0.015s at Tue May 28 2013 09:42:26 GMT+0100 (GMT Summer Time) - Wai
ting...
OK
>> File "app\styles\main.scss" changed.


Running "compass:server" (compass) task
overwrite .tmp/styles/main.css

Running "watch" task
Completed in 1.995s at Tue May 28 2013 09:42:41 GMT+0100 (GMT Summer Time) - Wai
ting...
OK

from generator-webapp_deprecated.

p-j avatar p-j commented on August 12, 2024

I have the same issue on Linux.
I'm running

node v0.8.23
yo 1.0.0-beta.6
generator-webapp 0.2.2
connect-livereload 0.1.4
grunt-cli v0.1.9
grunt v0.4.1

Neither HTML change nor SCSS change triggers the reload, even though the watch task executes.
I'm using the webapp generator.

Edit: Adding lrSnippet at the top is not helping

from generator-webapp_deprecated.

andymcfee avatar andymcfee commented on August 12, 2024

+1 I'm experiencing the same things as @p-j, same setup from a fresh yo webapp install, watch task executes, no refresh. Mac/Linux and adding lrSnippet had no effect.

from generator-webapp_deprecated.

akngs avatar akngs commented on August 12, 2024

+1 I'm using mac and experiencing same problem. The lrSnippet does not get injected at all.

from generator-webapp_deprecated.

p-j avatar p-j commented on August 12, 2024

After a few tests, and particularly jumping from node 0.8.23 to 0.10.8, and starting a brand new webapp folder, having lrSnippet at the top and the bottom, I'm able to have it working every other time when it's an SCSS change and almost every time when it's an HTML change. It's not very reliable though but that's better than nothing.

from generator-webapp_deprecated.

lanterndev avatar lanterndev commented on August 12, 2024

I'm just trying to figure out how to disable livereload in my Gruntfile since this issue is keeping me from more important debugging in IE, and it's not obvious. Unfortunately http://stackoverflow.com/questions/12830159/disable-livereload-w-yeoman was no help. Could you document this please?

from generator-webapp_deprecated.

altano avatar altano commented on August 12, 2024

I'll add my experience: I'm on Windows 7 and,

  1. with generator-webapp 0.2.2, with lrSnippet at the end, it works fine.
  2. with generator-webapp master, with lrSnippet at the beginning, I cannot get the web server to load at all in both Chrome and IE10. In Chrome it eventually times out with the error "no data received."

This is the case for me with other projects that use connect-livereload, such as generator-jekyllrb.

I don't know anything about connect, so if someone could give me pointers on how to investigate further I would be happy to dive in.

@Skivvies, just completely remove the two lines that refer to "lrSnippet" from your Gruntfile to disable livereload.

from generator-webapp_deprecated.

altano avatar altano commented on August 12, 2024

Just in case anyone else is experiencing these issues on Windows, the grunt-contrib-livereload snippet middleware for connect works perfectly. So you can just swap out:

var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});

with:

var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;

Obviously you'd want to remove connect-livereload and npm install --save-dev grunt-contrib-livereload first.

from generator-webapp_deprecated.

andineck avatar andineck commented on August 12, 2024

I'll do some debugging tomorrow...

from generator-webapp_deprecated.

andineck avatar andineck commented on August 12, 2024

I refactored the connect-livereload module.
API remains, but it should be robust now.
New Version: v0.2.0

Please see: #7

from generator-webapp_deprecated.

altano avatar altano commented on August 12, 2024

Just an FYI that I tested andi's fixes in 0.2.0 and connect-livereload now works perfectly for me.

from generator-webapp_deprecated.

damienmortini avatar damienmortini commented on August 12, 2024

I've installed connect-livereload 0.2.0 and I have the latest versions of nodejs and generator-webapp, it works fine with html/css but stills doesn't reload with sass or coffeescript... I'm on Windows 8

Edit: I succeed to make it works by putting watch task options.nospawn tot false, I'm not sure if it's the correct behavior ?

from generator-webapp_deprecated.

andineck avatar andineck commented on August 12, 2024

All connect-livereload does is: appending the live-reload snippet to the </body> element of the html. It does not matter if you use coffeescript or sass, as long as your views contain the </body> element (at the time of the execution of res.write).

from generator-webapp_deprecated.

addyosmani avatar addyosmani commented on August 12, 2024

Thanks for letting us know about this, @andi-neck. We've been putting out some fires lately related to livereload not correctly working with Sass/CS but from what I've seen this is more likely an issue on our end (we still saw these issues after updating to latest).

@DmmN The nospawn:false change has been suggested in other threads. We haven't applied a fix for this as yet as it isn't resolving the issues for about 30% of the people running into LR problems.

from generator-webapp_deprecated.

andineck avatar andineck commented on August 12, 2024

No worries, I hope you can get it to run in the different environments. Prior to V0.2.0 the connect-livereload middleware was a bit shaky because non html files had to be filtered out with the excluedeList or had to be loaded after the static routes. Now it should handle all files correctly (I hope, otherwise I'm glad to hear).

One thing I didn't test so far is whether it works with templates like Jade or Haml. Has anyone tested with these?

from generator-webapp_deprecated.

addyosmani avatar addyosmani commented on August 12, 2024

I patched this in master. Can someone on Windows verify this issue is now fixed there?

from generator-webapp_deprecated.

damienmortini avatar damienmortini commented on August 12, 2024

@addyosmani I just tested it on Windows 8-64/Chrome and it works perfectly including with coffee and sass, thank you for the quick fix.

from generator-webapp_deprecated.

addyosmani avatar addyosmani commented on August 12, 2024

Excellent. Thank you for testing!

from generator-webapp_deprecated.

MohamedAlaa avatar MohamedAlaa commented on August 12, 2024
gem install guard-livereload 

fixed the issue for me.

from generator-webapp_deprecated.

pavelbinar avatar pavelbinar commented on August 12, 2024

I am still having this problem even I just install latest yeoman with latest webapp generator.
Is there any information I can provide you to resolve this?

Thanks!

from generator-webapp_deprecated.

andineck avatar andineck commented on August 12, 2024

I guess many things have changed concerning livereload. The original issue had to do with the connect-livereload module. But this dependency does not seem to be there anymore.
If you want to test it, the latest version (v0.3.0) should have fixed the issue.
npm install connect-livereload --save-dev and follow the grunt-example in the readme.

from generator-webapp_deprecated.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.