This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-10
Channels
- # announcements (2)
- # asami (2)
- # babashka (29)
- # beginners (115)
- # cider (5)
- # clara (9)
- # cljdoc (14)
- # cljs-dev (1)
- # cljsrn (18)
- # clojars (3)
- # clojure (73)
- # clojure-australia (7)
- # clojure-europe (74)
- # clojure-nl (3)
- # clojure-norway (8)
- # clojure-spec (3)
- # clojure-uk (36)
- # clojured (1)
- # clojurescript (15)
- # conjure (18)
- # datomic (6)
- # deps-new (11)
- # depstar (7)
- # fulcro (2)
- # instaparse (1)
- # jobs (9)
- # nrepl (8)
- # off-topic (21)
- # pathom (5)
- # polylith (42)
- # proletarian (1)
- # rdf (10)
- # re-frame (2)
- # react (1)
- # reagent (20)
- # releases (3)
- # remote-jobs (4)
- # rum (9)
- # shadow-cljs (79)
- # sql (11)
- # tools-deps (64)
- # vim (3)
- # xtdb (26)
I added a new dependency in shadow-cljs.edn, (by the way I’m using intellij + cursive) and re-ran shadow-cljs watch app. But my cljs file still cannot find required libraries in the namespace.
if its already running no, you need to restart it fully. shadow-cljs stop
should shut it down completely
also depends on how you have configured shadow-cljs.edn. if you have a :deps
key in there then dependencies need to be added in deps.edn. if there is a :lein
then it would be project.clj
.
ah, thought you meant shadow-cljs didn't find dependencies. yeah shadow-cljs pom to make the dependencies visible for Cursive
Hi! I'm interested in how to manage the versions of the JS bundle. I have read the part of the documentation https://shadow-cljs.github.io/docs/UsersGuide.html#_cacheable_output and knowing that my html is generated by hiccup, I am thinking of using the solution from the manifest.edn file. Are there some leads? How do you do with Shadow-cljs when an index.html file is used to call the script?
@admin055 if you just have a static html file you can use this hook https://github.com/thheller/shadow-cljs/blob/master/shadow-cljs.edn#L147-L149
that'll take the source and rewrite the html script tags eg. https://github.com/thheller/shadow-cljs/blob/master/out/demo-browser/index.src.html#L10-L11
> slurp -> edn/read-string and transform it however you need. its just clojure data. Perfect, that's what I'm putting together. Thank you for confirming that I am going in the right direction.
I was not aware of this hook, it's wonderful! Thank you
@thheller Shadow-cljs is full of hidden gems ... I never regret when I ask questions! 🙂
Another question.
If I doesn't the built-in Shadow server and want to watch/reload the CSS file locate in resources/public/css/app.css
, what path do I put in {:devtools {:watch-dir "???"}}
option?
The path must be in the classpath too?
I tried multiple solution but no success.
Yes, this is the case.
Strange, I already try with this path but no success.
Oh ok, I try to restart
After restarting, I touch resources/public/css/app.css
but not rebuild happened
Yes I know I am using postcss for this. I meant reload
CSS reload
and I'm assuming resources/public/css/app.css
is the OUTPUT file produced by postcss, not the input?
Yes the output file.
<link href="/css/app.css" rel="stylesheet" type="text/css">
and your webserver doesn't cache the file or so? I mean what do you see in the browser console? shadow-cljs should be telling you what it is doing
I just got it. My public folder does not contain an index.html file as this is handled by hiccup. I thind watch-dir works only with html file, right?
OK, good to know
> and your webserver doesn't cache the file or so? I mean what do you see in the browser console? shadow-cljs should be telling you what it is doing I'll do some tests and I'll tell you
there really isn't much to this. :watch-dir
will cause shadow to watch that directory and notify about file updates. the client will look for CSS matches by path and reload if found
again ... look at the console. if you see a load CSS
message from shadow-cljs but css didn't update then your server likely caches stuff and didn't return the "new" version
Load CSS shows up and CSS reload now, perfect!
I think my various tests without restarting shadow-cljs watch misled me. A big thank you again!
More I works with Shadow-CLJS and more I'm impressed by the nice piece of librarie that it is! 😉
I’ve got a function in my app (defn my-fn [x] (do-stuff-with-x))
that gets sent the method toString
by some library code. How can I guarantee that toString
returns the same value for every build? (I think toString
is returning different values because advanced compilation is renaming the function).
I don't understand. "gets sent the method toString by some library code.". what does that mean?
but there is no way to guarantee that the function will always stay the same with :advanced
, at least as far as I'm aware
why can you not choose which string to use? why a stringified function? I don't get it. have some docs?
Sure, the documentation on the replication protocol is here: https://docs.couchdb.org/en/3.1.1/replication/protocol.html#generate-replication-id
and here is the pouchdb implementation https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-generate-replication-id/src/index.js#L15
I believe the idea is that you would want to re-start replication from scratch if any of the parameters for the replication changes
and where is that function used? everything going through :advanced
or even :simple
is never guaranteed to stay identical
I could fork the library (I already maintain a fork of this lib so it wouldn’t be a huge deal)
I mean any kind of minifier should have this issue? it might end up sort of stable but there is no guarantee
(defn ^:export my-fn [x] ...)
and as .filter
you use (js/Function. "function filterMe(x) { return
😛
Me again :) I just finished the Reagent front end integration of this demo app https://inertia.prestance-design.com/js and I'm going to tackle the optimization. For that I use the useful Shadow-cljs report and it seems to me that overall it looks to be well optimized? https://inertia.prestance-design.com/js/report.html Someone in the know could give me an opinion? Is there something to do in particular at the level of the CLJS bundle?
Or the final size seems reasonable.
Perfect, thanks for taking the time 👍