This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-08
Channels
- # announcements (14)
- # babashka (12)
- # beginners (140)
- # calva (2)
- # cider (22)
- # clj-commons (14)
- # clj-kondo (49)
- # cljdoc (34)
- # clojure (92)
- # clojure-europe (41)
- # clojure-france (2)
- # clojure-new-zealand (2)
- # clojure-nl (2)
- # clojure-norway (60)
- # clojure-uk (17)
- # clojured (2)
- # clojurescript (7)
- # community-development (3)
- # conjure (2)
- # cryogen (13)
- # cursive (4)
- # data-oriented-programming (2)
- # datahike (5)
- # datomic (12)
- # defnpodcast (10)
- # events (2)
- # fulcro (20)
- # gratitude (3)
- # honeysql (4)
- # introduce-yourself (3)
- # jobs (10)
- # lsp (58)
- # malli (12)
- # missionary (19)
- # off-topic (8)
- # pathom (18)
- # podcasts-discuss (1)
- # polylith (41)
- # releases (1)
- # remote-jobs (3)
- # shadow-cljs (52)
- # spacemacs (1)
- # sql (37)
- # xtdb (19)
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
Thanks @U0522TWDA
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?
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?
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
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?