This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-26
Channels
- # announcements (3)
- # babashka (23)
- # beginners (54)
- # calva (9)
- # cider (8)
- # clj-kondo (18)
- # cljsrn (25)
- # clojure (69)
- # clojure-australia (1)
- # clojure-europe (7)
- # clojure-spec (13)
- # clojure-uk (1)
- # clojurescript (122)
- # conjure (8)
- # cursive (15)
- # defnpodcast (9)
- # deps-new (2)
- # emacs (22)
- # fulcro (10)
- # graalvm (36)
- # luminus (5)
- # meander (5)
- # minimallist (1)
- # observability (6)
- # off-topic (54)
- # reagent (8)
- # reitit (2)
- # releases (1)
- # reveal (25)
- # shadow-cljs (21)
- # tools-deps (50)
- # vrac (1)
- # xtdb (2)
@ozzloy_clojurians_net you need to dereference the atom inside a component
You’re derefing it inside the call to render which doesn’t setup the tracking correctly
Is there any smaller implementation of pprint suitable for cljs usage? Including clojure.pprint
to my application adds about 90KB to the final bundle size, which ends up being like 40% of my application size, but I'd love to be able to pprint in production env as well (currently excluding it for production builds)
Hey folks, I have been out of the loop with clojurescript for a while, are there any guides out there that list the recommended libraries (that are actively maintained) for the common frontend tasks? Also, do people use things like postcss or are there cljs alternatives? Do people use webpack to get access to all the plugins?
Re recommendations, everything is pretty opinionated as far as I know. I know some groups "standarized" in just using re-frame + reagent, pulling in npm modules for smaller functionalities as needed. Some of them do inline styling in hiccup, others use a css file, others use styled-component. I haven't myself came across any (cljs) projects using webpack, shadow-cljs/figwheel/figwheel-main handles pretty much every common frontend workflow as far as I know
Looking for a bit of help from somebody with more knowledge of the inner workings of ClojureScript here, any help appreciated! I’m attempting to enumerate over fn defintions in an ns and fetching each fn’s metadata, however I’m running out of ideas on how to accomplish this. This is as far as I’ve gotten. Is it even possible to do what I’m trying to do?
; in my.ns
(defn a {:x :a} [])
(defn b {:x :b} [])
(:x (meta (var a))) => :a
(:x (meta (var b))) => :b
(doseq [f (keys (ns-publics 'my.ns))]
(meta (var f))) => Unable to resolve var: f in this context...
@looveh You can use (ns-publics ’my-namespace) to get back a map of symbols to var expressions
I am trying to find out if there is a way to prevent the modularization step of compilation. Specifically, what are all the ways cljs.closure/src-file->goog-require is invoked? I can see there is an invocation within src/main/clojure/cljs.repl.cljc’s load-file at line 622, but how about the cases where we just want to make a build, no repl? Thanks for any comment.
hello everyone, I could use some advice to get back into the cljs ecosystem after a long hiatus
2-3 years ago I built some stuff using “reagent + figwheel + cljsjs”, is that still a viable setup?
ahh, I did not know there was a new version out, and the Reagent lein template still uses lein-figwheel. Looks like I can use https://github.com/bhauman/figwheel-main-template instead. thanks for the pointer! 🙏
I'm not sure deps.edn rather than leiningen is a "for sure" yet. I haven't found a feature of deps.edn that isn't already supported by leiningen. Only thing I can think of is that deps.edn is more "blessed" by the core clojure team
yeah, generally (in my experience, not doing anything too fancy), leiningen "just works" too. Hence the uncertainty around you using "for sure". I don't mind what you use, but plenty of the ecosystem still uses leiningen, for what's it worth
I’m just giving my opinion. I’ve used both heavily and there’s just no comparison. Feel free to disagree
I’ve poked around a bit and now there is shadow-cljs, :foreign-libs and tons of other new stuff, so I’m worried I’m doing something completely outdated
#figwheel and #reagent are definitely still active
good to hear! if I’m using those two, what would be the “go-to” way to import libraries such as Semantic-UI-react?
it used to be cljsjs but from what I gather there’s been a lot of change in that space recently
right! I have very limited knowledge of the broader JS ecosystem (I’m a primarily a Clojure/Java guy), so safe to say I should stick to cljsjs then :thumbsup:
is that true with the recent cljs npm interop changes though? my understanding is that shadow is outmoded by the cljs way
The other way requires setting up bundlers and I’m not sure the best way to do that. With shadow it’s a simple npm install and shadow does everything for you
yes the whole point of the cljs changes is to use webpack like the rest of the JS ecosystem does
but if i were starting a new project at this moment in time, i'd go that route for sure
I will say that I am a simple dev and cljs+figwheel+reagent has gotten me very far, even with all the fancy features you mentioned. Here is a little self-inflated demo project that incorporates all of those things: https://github.com/jjtolton/rocinante That being said ... for anything MORE complex than the features I have here... I've been checking out the shadow docs and shadow is killin' it with features.
does anyone know if it is possible to dynamically construct "qualified keywords" at reader / compile time ? ideally taking the form :ns/class/field
(i've tried both a macro and a tagged literal but neither will get evaluated prior to clojure spec's macro expansion time)
here is my reader implementation for details on what i'm trying to accomplish:
(defn read-ns-grouped-keyword [s]
`(let [[group# kwd#] (clojure.string/split ~s #"/")]
(keyword (clojure.string/join "/" [~(str *ns*) group#]) kwd#)))
@johanatan :cljs.user/event/type
is not a valid keyword, otherwise just ::event.type
will be :current.ns/event.type
?
i have two requirements here: (name kw)
must produce exactly type
and it must be qualified by namespace and the word "event"
i.e., this is the actual problem: https://clojurians.slack.com/archives/C03S1L9DN/p1601144150065700
I don't understand the problem statement. I looks to me like the slash is the only problem.
::event.type
will be fine while ::event/type
will look for the event
alias which probably doens't exist
the problem statement is that this needs to happen at reader expansion time or macro expansion time (prior to spec's own macro expansion time)
cljs.user=> (name ::event.type)
"event.type"
^^ that needs to say just:
"type"
rather than:
"event.type"i'm trying to retrofit clojure spec to an existing non-optimal (for spec) data model
of course there isn't. hence the question. i wouldn't be exploring macros and tagged literals if there were a built in way
the multi-spec section of this page uses a "non-namespace, qualified keyword": https://clojure.org/guides/spec
I wrote an impl a long time ago that works on "unqualified maps" directly and not via spec :req-un
definitely do not use that implementation but maybe something in that direction works better for your usecase?
i'm afraid i'd have to reimplement a lot. it'd be basically the whole "multi-spec" section of that clojure guide
/ has special meaning in symbols. It can be used once only in the middle of a symbol to separate the prefix (often a namespace) from the name
I'm not trying to quibble over anything. I'm pointing out that you are actively trying to fight the system and namespace and names. nothing in clojure will let you do that easily. of course you can do so but I would still warn you strongly against doing so since it will most likely need to more trouble in the future somewhere
there is "no fighting the system". there is only "dynamically creating qualified keywords at reader/compile time"
(that was how all examples I've seen do it so I figured it must be part of the contract)