This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-29
Channels
- # beginners (18)
- # boot (1)
- # cider (12)
- # clojure (18)
- # clojure-russia (5)
- # clojure-uk (8)
- # clojurescript (17)
- # cursive (7)
- # datomic (10)
- # editors (1)
- # figwheel-main (14)
- # hoplon (2)
- # hyperfiddle (1)
- # keechma (2)
- # leiningen (25)
- # off-topic (5)
- # onyx (3)
- # reagent (53)
- # reitit (6)
- # shadow-cljs (14)
- # spacemacs (3)
- # tools-deps (14)
- # uncomplicate (12)
How does one get hot code reloading in a shadow-cljs project? I found :after-load app.main/reload!
on the home page of shadow-cljs added it to my .edn
file, but when i change css property of an element in component the browser does not reflect the change, i had to refresh to get the new styling. Is there something else i am missing here.
@prabhath6 what does your reload! function do?
shadow-cljs does hot code reloading by default, but it needs to know what to run - you can define a function in any ns and then tell shadow-cljs to run that function before or after reloading your code
thanks, do you have any example that i can refer to. I am completely new to clojurescript and shadow-cljs
sure. there are a number of examples here: https://github.com/shadow-cljs/examples
the user guide is also a really good resource: https://shadow-cljs.github.io/docs/UsersGuide.html
I usually am working with react, so my start!
or reload!
function usually just re-renders my application
here’s a really simple example that I just wrote this morning / last night: https://github.com/Lokeh/lilac.town/blob/master/src/lilactown/client/core.cljs
thanks for the input. I was able get it working. I was rendering my application again in the reload function. But i am not sure if this is the right way to do it.
(defn reload! []
(r/render
[some-component]
(.getElementById js/document "app")))
(defn ^:export main
[]
(r/render
[some-component]
(.getElementById js/document "app")))
Can i make it better or is this good enough.Usually I would just call main
again in my reload!
function so that I don’t have to change it twice 😄
i was thinking the same, abstract it and call it in both the methods. Thanks for help 👍
shadow-cljs does hot code reloading by default, but it needs to know what to run - you can define a function in any ns and then tell shadow-cljs to run that function before or after reloading your code
I usually am working with react, so my start!
or reload!
function usually just re-renders my application