Does somebody have something like an auto-refresh in the browser when working with cryogen (and asciidoc)?
I'm running clojure -X:serve but whenever I make a change I have to wait at least a few seconds and then refresh the browser manually
I use serve-fast + ring's auto-refresh https://github.com/holyjak/blog.jakubholy.net/commit/b064460de7e9b4633d9a7e7f7138d4ca40d16208#diff-301d323c030f8e21487c9a82e89cbd702fc7a6767a2c5b06a637923286ba64baR85-R86
But what about your code, do you use this ☝️ code or do you have your own? Perhaps also worth checking version of ring? You could also inspect the middleware to verify that wrap-refresh was executed, perhaps add some logging to https://github.com/weavejester/ring-refresh/blob/master/src/ring/middleware/refresh.clj to find out what is happening?
If refresh is really enabled, it will inject a piece of JS right under <html>, this one https://github.com/weavejester/ring-refresh/blob/master/src/ring/middleware/refresh.clj#L20 - do you see it injected?
Yes it's used by default with fast alias. I can try to debug this a bit later.
In theory != in practice :)
Well, that's not in theory- that code is used. But I guess I need to debug it to know more :)
I'd say all looks good but it's simply not refreshed.
The javascript is there, injected in <head>
Ok, mystery solved.
The problem is in the Nucleus template I'm using.
It's overriding window.onload set by ring's refresh mechanism: https://github.com/curiousprogrammer-net/curiousprogrammer.blog/blob/develop/themes/nucleus/js/scripts.js#L3
Btw. I tried to fix the alias definition here: https://github.com/cryogen-project/cryogen/pull/250
Thanks Jakub a lot for showing me where to look.
Thx a lot for the fix and for creating the issue!
Perhaps a generic fix would be not to override the onload fn but first check if it is set, copy it, and call it as well?
Thanks @holyjak
From what I can tell this is actually in cryogen core nowadays: https://github.com/cryogen-project/cryogen/blob/master/src/leiningen/new/cryogen/src/cryogen/server.clj
I tried to run clojure -X:fast but it makes no difference - the browser simply isn't auto-refreshed.
Am I missing some little piece in the configuration?