Comments (30)
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.
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.
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.
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.
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
from generator-webapp_deprecated.
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.
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.
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.
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.
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.
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.
+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.
+1 I'm using mac and experiencing same problem. The lrSnippet does not get injected at all.
from generator-webapp_deprecated.
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.
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.
I'll add my experience: I'm on Windows 7 and,
- with generator-webapp 0.2.2, with lrSnippet at the end, it works fine.
- 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.
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.
I'll do some debugging tomorrow...
from generator-webapp_deprecated.
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.
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.
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.
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.
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.
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.
I patched this in master. Can someone on Windows verify this issue is now fixed there?
from generator-webapp_deprecated.
@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.
Excellent. Thank you for testing!
from generator-webapp_deprecated.
gem install guard-livereload
fixed the issue for me.
from generator-webapp_deprecated.
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.
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)
- To many node modules ? HOT 1
- Livereload and mocha HOT 2
- Cannot press space to select HOT 1
- Configure generator-webapp to use SSL HOT 6
- apple-touch-icon.png is not optimized in imagemin HOT 1
- Additional Bower dependencies HOT 2
- Add option to CSSNext HOT 1
- grunt-contrib-imagemin version should be updated HOT 1
- Problem with default configuration of gruntfile HOT 2
- Building the dist : 'Fatal error: Cannot read property 'contents' of undefined' HOT 6
- problems installing compass & susy in webapp yeoman generator. HOT 4
- required module don't install automatically HOT 1
- My css file in the dist folder is empty HOT 1
- add_import_path to fix compass warning HOT 2
- Deprecation of generator-webapp but it was still include in Getting started instruction in Yeoman HOT 3
- concat target doesn't consolidate babel output HOT 2
- Cannot grunt build app without running into errors HOT 5
- Assemble recipe error HOT 2
- Add receipes to yeoman generator HOT 3
- DEPRECATION NOTICE
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 generator-webapp_deprecated.