Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Grunt 0.3.17] reload task launches server each time & doesn't trigger refresh #23

Open
cemckinley opened this issue Jan 18, 2013 · 1 comment

Comments

@cemckinley
Copy link

Related to Issue #13

Same problem using Grunt 0.3.17 and grunt-reload 0.2 - the reload server is launched every time the reload task is run, therefore no page refresh is triggered. Unfortunately I can't upgrade to grunt 0.4 to get the updated version of the grunt-reload plugin, due to some other breakages.

I tried manually updating the reload.js task file to the 0.4 version (and installed the request dependency), and this fixes the issue except for one line that causes an undefined error - line 73:

var connectOpts = grunt.config(['connect', target]).options;

Not sure if the 'connect' config item is something new to grunt 0.4, but it's not required in my own 0.3.17 grunt file. Setting the connectOpts var to an empty object allowed the code to move on and run successfully.

I only tried the above with the proxy method, not iframe or liveReload so not sure if anything would affect those or other parts. Would love to see a fix implemented for 0.3.17 as well.

@logankoester
Copy link

I am also affected by this issue. Using the proxy method, I was able to work around the bug by overwriting reload.js from master (after running npm install request, a new dependency), but grunt dies when a LiveReload client connects:

/home/ldk/hack/learn/grunt-reload-bug/node_modules/grunt-reload/tasks/reload.js:198
                        grunt.event.emit('reload:' + data.command, connection)
                                    ^
TypeError: Cannot call method 'emit' of undefined
    at WebSocketConnection.module.exports.grunt.registerTask.that (/home/ldk/hack/learn
/grunt-reload-bug/node_modules/grunt-reload/tasks/reload.js:198:37)
    at WebSocketConnection.EventEmitter.emit (events.js:96:17)
    at WebSocketConnection.processFrame (/home/ldk/hack/learn/grunt-reload-bug/node_modules/grunt-
reload/node_modules/websocket/lib/WebSocketConnection.js:403:26)
    at WebSocketConnection.handleSocketData (/home/ldk/hack/learn/grunt-reload-bug/node_modules/gr
unt-reload/node_modules/websocket/lib/WebSocketConnection.js:247:14)
    at Socket.EventEmitter.emit (events.js:96:17)
    at TCP.onread (net.js:396:14)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants