This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-30
Channels
- # aleph (12)
- # beginners (23)
- # boot (12)
- # cider (40)
- # cljs-dev (8)
- # cljsrn (20)
- # clojars (1)
- # clojure (122)
- # clojure-canada (2)
- # clojure-dev (21)
- # clojure-gamedev (2)
- # clojure-italy (3)
- # clojure-nl (12)
- # clojure-norway (1)
- # clojure-sanfrancisco (3)
- # clojure-spec (59)
- # clojure-uk (114)
- # clojurescript (50)
- # clojurex (1)
- # cursive (2)
- # datascript (2)
- # datomic (26)
- # emacs (5)
- # fulcro (19)
- # garden (1)
- # hoplon (54)
- # leiningen (42)
- # luminus (14)
- # off-topic (24)
- # om (5)
- # onyx (7)
- # re-frame (2)
- # reagent (31)
- # reitit (3)
- # ring-swagger (39)
- # shadow-cljs (8)
- # sql (3)
- # tools-deps (13)
I’m trying to wrap my head around the new build system. So, I want to achieve automatic recompilation of some Node targeted stuff.
I stuck this stuff in a file called compile.sh
:
#!/bin/sh
clj -m cljs.main --target node --output-to resources/server/main.js -c landing-page.core
node resources/server/main.js
Then I figured, I just need to re-run it on file changes in src
. I reached for nodemon
for that:
nodemon -e clj,cljs --watch src --exec "./compile.sh"
While compile.sh
works well on it’s on, it throws SIGSEGV (0xb) at pc=0x00000001110884d4, pid=4447, tid=0x0000000000000307
when run via nodemon
.
So, what’s the correct way to achieve this goal?@henrik FWIW, cljs.main
has a --watch
option. See https://clojurescript.org/reference/repl-and-main
@henrik You aren't using it this way, but there is this defect to be on the lookout for https://dev.clojure.org/jira/browse/CLJS-2684
I'm searching a clojurescript library to modify a hiccup syntax tree instead html markup. who know any library for this?
@leobm You could just try https://github.com/nathanmarz/specter
@clojurians.net thanks, it looks interesting
I've used it on a number of projects and consider it absolutely essential for any even slightly complex data transformation. "Clojure's missing piece" is a fairly accurate description.
@clojurians.net easier than what I tried with clojure.walk
i'm using lein and lein-cljsbuild.. the auto functionality works really well... but is there a way to run a function after every re-build?
:notify-command
maybe?
I'm playing with zippers, ie clojure.zip
in clojurescript and the basics seem to work, but this example which creates a zipper for a mixed structure of maps and vecs fails for me: https://clojuredocs.org/clojure.zip/zipper#example-5845617fe4b0782b632278d3
It works ok if I cut and paste it into the clojure repl, but fails with
#object[TypeError TypeError: Cannot read property 'MapEntry' of undefined]
in the clojurescript repl. Is this expected?@soulflyer sounds like an issue with the latest ClojureScript version
(which introduced changes related to MapEntry)
or maybe it's the opposite, that you need a more recent version of ClojureScript
@soulflyer I'm seeing the same issue with lumo 1.7.0... not sure what's going on there
clojure.lang isn't a thing in CLJS so its probably complaining about MapEntry not being a field of clojure.lang
oohh. totally missed that
Yeah just make it MapEntry rather than clojure.lang.MapEntry @soulflyer
thanks that did it @tmulvaney
isa?
is incorrect as well isn't it?
should be instance?
Weird that you don't actually get a undefined variable error for clojure.lang.MapEntry though.
I think the "undeclared Var" warnings don't show up for when you're using the dot syntax, like: (prn a.b.c)
say I want to work on a cljs library that uses react. I have to pick between om, reagent, rum etc, there is no way to do it generically, right?
Hmm. Presumably you could just interact with React using plain JavaScript interop, in a way that can then be reused by apps using Om, Reagent, re-frame, etc.
I’m not sure how I would approach this, but If you think it might work, I think I’ll investigate further
Can you think of any libraries with a similar goal out there?
If you'd like to see a bare-bones approach to React directly from clojurescript, check out @weavejester Brutha library for tips
this is hopefully an easy question, but what’s the best approach to including a value in a div tag? for example within a let if have this
[:div.cond-display
[:i.wi.wi-owm-800]]
but rather than hardcoding that 800 i want that to be determined by the value of $fooyour question says one thing but your code says another: you ask "how to include a value" but your code says "I want to have a dynamic class on this element", to which I reply:
(let [your-value 800]
[:div.cond-display
[:i.wi {:class (str "wi-owm-" your-value)}]])
if you meant the other thing:
(let [your-value 800]
[:div.cond-display
[:i.wi.wi-owm your-value]])
@joelsanchez thank you, i didn’t know how to formulate my Q 🙂 but succeeded in communicating the gist of it
most hiccup implementations (all?) will happily merge inline classes with :class
, so that will work, we do it all the time
yeah, common problem 🙂
that’s shorthand to make it easier yes: so the long form that you demo’d is what i want. thank you!
If you'd like to see a bare-bones approach to React directly from clojurescript, check out @weavejester Brutha library for tips