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

Livereload with custom script file #78

Open
tjunussov opened this issue Dec 4, 2016 · 2 comments
Open

Livereload with custom script file #78

tjunussov opened this issue Dec 4, 2016 · 2 comments

Comments

@tjunussov
Copy link

There is library called PJAX, which makes static site/spa fully AJAXed, browsing experience becomes much faster, because it reuses all js and styles and loads only html content.

While developing such projects with devd, this a little bit inconvenient, as devd reloads page fully
with location.reload()

1) Is it possible to run devd -l but not to inject livereload script ?
or provide my own modified script devd -l=myscript.js

or

  1. Maybe possible to call js function before reload which could be overridden ?

288: ws.onmessage = function(event) {
289: if (event.data == "page") {
290: ws.close();
291: if(DevdReconnectingWebSocket.reload())

DevdReconnectingWebSocket.reload = function(){
location.reload();
}

@cortesi
Copy link
Owner

cortesi commented Dec 4, 2016

Hi there. I think the best way might be for the livereload script to check whether a specially named function is defined (say, __devd_livereload). If the function is in the global scope, it's called rather than hard-reloading the page. Would this work for you? I'd accept a patch that implements something like this.

@tjunussov
Copy link
Author

yes this would be ok! I will try to send patch

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