This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-10
Channels
- # aws (39)
- # babashka (4)
- # beginners (5)
- # biff (25)
- # cider (14)
- # clj-on-windows (40)
- # clojure-europe (36)
- # clojure-gamedev (1)
- # clojure-losangeles (4)
- # clojure-norway (51)
- # clojure-spec (5)
- # clojure-uk (2)
- # clojurescript (2)
- # clr (176)
- # data-science (10)
- # datalevin (17)
- # datomic (7)
- # deps-new (4)
- # docs (3)
- # emacs (12)
- # figwheel (3)
- # figwheel-main (5)
- # hyperfiddle (20)
- # instaparse (3)
- # introduce-yourself (8)
- # lsp (66)
- # malli (43)
- # off-topic (4)
- # rdf (11)
- # reagent (5)
- # releases (2)
- # sci (11)
- # shadow-cljs (24)
- # slack-help (2)
- # specter (7)
- # tools-deps (3)
- # xtdb (48)
I am trying to come up with a shadow build of a Web/MX app currently built/run with figwheel.main.
This shadow https://github.com/shadow-cljs/quickstart-browser is perfect, but it does not actually do anything but present the index.html
as is. The missing bit is where our code replaces the "app" , but I guess it goes here, with suitable requires for the goog.*
stuff:
(defn init []
;; init is called ONCE when the page loads
;; this is called in the index.html and must be exported
;; so it is available even in :advanced release builds
(js/console.log "init")
;; ---- new code ---
(let [root (gdom/getElement "app")]
(set! (.-innerHTML root) nil)
(gdom/appendChild root
(gdom/safeHtmlToNode
(sanitizer/sanitize "<h2>Hi, Mom!!!</h2>"))))
;; ---- end new ----
(start))
In my figwheel stuff that new code is just a top-level form in the core file.
Aside: I grok that that only runs once. Web/MX manages DOM dynamically on its own. Not sure what hot reload will bring, but see we will.
If that ^^ does not look horrifyingJust getting up to speed slowly. The quickstart never replaces the "app" node, and that step is what I wanted to change. The QS start
just logs to the console. If that also was where QS launched its own app, perhaps just to show a SPAN saying "hello app", I would have had the full picture. In hindsight it seems clear. I caught on anyway thanks to this excellent https://code.thheller.com/blog/shadow-cljs/2019/08/25/hot-reload-in-clojurescript.html#:~:text=shadow%2Dcljs%20has%20its%20own,is%20very%20much%20the%20same. and I see now I could have replaced the "app" node in the start fn, or had the init fn call my own function that replaces "app". Very nice. Thx! 🙏
Running npx shadow-cljs
on my institutional machine behind a proxy I get
UnknownHostException <proxy.address:port>: invalid IPv6 address
I'm asking in #C6N245JGG because I have my proxy configured in .m2/settings.xml and that seems to work when I run clj
with :mvn
deps in another project. npm i
also works.Take pity on me, this has ruined my morning. I have attempted to set _JAVA_OPTIONS='-.preferIPv4Stack=true'
, this is recognized but doesns't help.Sounds like an issue with the shadow-cljs server starting up behind your company VPN, but there is insufficient information here
I think I'm not even reaching the point of starting the server; it fails to download the artifacts from maven
just run with clj if that works? https://shadow-cljs.github.io/docs/UsersGuide.html#deps-edn
@U05224H0W if you want an issue or a doc pr filed mentioning this reason for using clj please let me know; I am happy to provide
you can configure :maven {:proxy ...}
in shadow-cljs.edn or ~/.shadow-cljs/config.edn
it seems to be used because my proxy address is showing up in the stack trace, even if I prepend the command with http_proxy= https_proxy=
but... it looks like running with clj can be made to defeat this issue
Hi!
In my browser project I have a macro that reads a couple of Markdown-files into a map and binds that map to a var. I have marked the namespace using that macro to reload on any change (with :dev/always
). That works pretty well except for one thing: changes to the MD-files do not trigger a reload although they're in one of my source paths. I always have to touch one of my cljs
files to update the var. Is there any way to have non-`.clj(s)` files watched and trigger a reload?
Guys amazing thank you