Fork me on GitHub
#clojurescript
<
2017-08-30
>
brthrjon01:08:22

hello, all. I’ve been developing an app using lein and figwheel pretty seamlessly, but now I’m trying to make a non figwheel build and can’t seem to get goog/base.js, cljs_deps.js into the ;asset-path, it is always empty after I run “lein cljsbuild once target”… is there another command i should run to get those built/copied?

iku00088802:08:04

@brthrjon Would it be possible to share the build configurations? (cljsbuild+figwheel)

iku00088802:08:09

From my experience lein cljsbuild once ... would copy stuff in the asset path so suspecting something with the configuration

brthrjon02:08:58

@iku000888 here is the target i’m invoking, thanks… is this enough?

brthrjon02:08:59

{:id “qa” :source-paths [“src/cljs”] :compiler {:main viime.core :foreign-libs [ {:file “src/easyrtc/socket.io.js” :provides [“socket.io.js”]}, {:file “src/easyrtc/easyrtc.js” :provides [“easyrtc.js”] :requires [“socket.io.js”]} ] :output-dir “resources/public/js/compiled/qa” :asset-path “js/compiled/qa” :output-to “resources/public/js/compiled/app.js” :optimizations :none}}

brthrjon02:08:28

thanks in advance

genekim05:08:59

@brthrjon I was fixing issues like this in my code for the last couple of days. Eyeballing this against mine, I think you just need to add out to your :asset-path. Here’s mine:

:output-to            "../../public/build/app.js"
                    :output-dir           "../../public/build/compiled/out"
                    :asset-path           "js/compiled/out"

lxsameer09:08:07

@dnolen I was watching one of your talks for last year, you mentioned that in ViennaJS meetup there was a talk about a team moving away from js to elm to Clojurescript

lxsameer09:08:22

I couldn't find that talk, do you remember the title ?

lxsameer09:08:56

@philippmarkovics did you guys moved to om next ?

philippamarkovics09:08:41

nope, we stayed with reagent and re-frame (and looking at re-posh)

lxsameer09:08:31

did you guys tried om next at all ?

philippamarkovics09:08:59

we tried it for a smaller app, also for an ios app together with re-natal

philippamarkovics09:08:24

really like how it works but for the nextjournal usecase, re-frame might be better suited

lxsameer09:08:54

sorry to take your time. I used only re-frame and I really like to know about your experience with om next

lxsameer09:08:19

like what do you like and dislike about it

lxsameer10:08:49

@philippmarkovics are you applications open source ?

philippamarkovics11:08:44

re-frame vs. om next: re-frame is easy to get started and has great documentation. om next has quite a learning curve and didn’t have much documentation when we evaluated it.

philippamarkovics11:08:50

maybe docs are better now

lxsameer11:08:17

what about the workflow ?

lxsameer11:08:27

are they similar ?

philippamarkovics11:08:35

in terms of design i really liked om next better but it seems more geared towards graphql-like backends which we don’t use

philippamarkovics11:08:38

that’s where it shines

philippamarkovics11:08:46

workflow is similar

lxsameer11:08:59

cool thanks man

philippamarkovics12:08:06

we’re also at a point now where we have so much re-frame code that it would be quite the investment to switch to something else

philippamarkovics12:08:23

we wanna have datalog queries for querying state but you can have that with re-posh

philippamarkovics12:08:10

re opensourcing the nextjournal frontend: we’re probably going to do that but only after we feel it’s stable enough

philippamarkovics12:08:30

so this will take some time

emilaasa11:08:02

Is there a slideshow/presentation lib that is popular for clojure? Something like revealjs

jcw12:08:29

asked on IRC, but perhaps this is a better venue: I have a question about advanced optimisation w/ reagent - am running into trouble with google closure's renaming - I've narrowed it down to this call: (defn get-dom-width [elt] (.log js/console "gdw:", (.getBBox (r/dom-node elt))))

jcw12:08:45

the ".getBBox" is not found - is there an easy fix? - I don't understand how to set up an externs file for this

dnolen12:08:01

but what is .getBBox what library provides that?

jcw12:08:52

it's part of all SVG elements, IUC - I'm using it on a <text ...>...</text>

juhoteperi12:08:35

@jcw Doesn't doesn't sound like problem with renaming, if the error mentions .getBBox

juhoteperi12:08:20

Did you check that elt is non-nil?

jcw12:08:22

the error msg is Uncaught TypeError: tq(...).Xd is not a function

jcw12:08:37

it works with opt = none

juhoteperi12:08:45

Okay. Svg externs are available somewhere.

jcw12:08:59

called from a :component-did-mount

juhoteperi12:08:58

Would make sense to package this at Cljsjs

jcw12:08:06

ahhhh! - thanks, I'll check

juhoteperi12:08:17

Closure contrib folder also has one, this seems to be more recent: https://github.com/google/closure-compiler/blob/master/contrib/externs/svg.js

jcw12:08:17

\o/ - :externs ["svg.js"] works - terrific, many thanks for your help!!!

daiyi13:08:34

^ I realised this above question might be better for this channel, because functions like instance don't work the same between clj and cljs and maybe type has similar issues :/

dnolen13:08:08

@daiyi type just returns the constructor function in ClojureScript

dnolen13:08:07

str will bottom out on .toString implementations

dnolen13:08:28

pr-foo fns print as it would at the REPL

dnolen13:08:36

so try (pr-str (type []))

daiyi13:08:01

!!! that works perfectly, thanks a bundle \o/

daiyi13:08:52

ah, I like this description of pr-str: "you can think of pr-str as the inverse of read-string, turn string into symbols"

dnolen13:08:10

pr-foo stuff is supposed to print “readably”, meaning you could feed it back into the reader (which could then pass that result to something else like the ClojureScript analyzer)

dnolen13:08:46

@daiyi note this trick won’t work for JavaScript in general, just ClojureScript deftypes and defrecords (which are just deftypes with defaults)

daiyi13:08:34

should be good for my purposes (: thanks for the details!

Joshua Suskalo14:08:48

I'm having a hard time getting cider to jack into a repl running in a lein figwheel project. Is there somewhere I can look to try to get those to talk to each other, or is there an editor that it might be worth trying out (like atom or lighttable) for the sake of clojurescript development with figwheel and an in-editor REPL?

michaelwfogleman15:08:36

@suskeyhose Not sure if this is the answer, but it sounds like you might want to try cider-connect rather than jack in

Joshua Suskalo16:08:09

Ah, okay. Thanks!

bbloom16:08:20

has anybody attempted to spec the cljs ast yet?

dnolen17:08:55

@bbloom not aware of that, there’s a ticket for that, was a bit stalled on 1.9 release - maybe the spec.alpha breakout means we can proceed but I haven’t looked into that

bbloom17:08:16

mostly just curious

wilkerlucio18:08:55

I noticed that in cljs the specs definition seems a bit eager, when I try to use definitions that are still pending to load it fires an error saying that the given spec doesn't exists (because of load order), I remember someone talking about this here in past, is that being tracked?

dnolen18:08:31

@wilkerlucio not sure what you mean - just supply something minimal that doesn’t work in ClojureScript (and works in Clojure) and report that

wilkerlucio18:08:49

@mfikes in my case it's simpler than that, just basic s/def, ok, I'll try to create a minimal case to exemplify

colindresj21:08:29

What’s the best way to use the clojurescript on master in order to get the @cljs-oss/module-deps/index.js fix mentioned yesterday to @petterik?

tjscollins21:08:23

I'm having some trouble with extend-protocol / extend-type in cljc code. What's the best way to do something like this:

(extend-protocol parse-dates
  #?(:clj java.lang.String :cljs string)
  (parse-date [date] (format/parse const/date-formatter date))
  (parse-datetime [date] (format/parse const/date-time-formatter date))
  (parse-date-at-time [date] (format/parse const/date-at-time-formatter date))

  #?(:clj org.joda.time.DateTime :clj function)
  (parse-date [date] date)
  (parse-datetime [date] date)
  (parse-date-at-time [date] date))
Everything I've tried throws some type of error or warning. For this version the warning is WARNING: Bad extend-type method shape for protocol parse-dates method parse-date, method arities must be grouped together at line 25. If I try to use extend-type instead it fails on the string symbol, but every example I've seen says to use string and not js/String. What's the correct way to do this?

tjscollins21:08:09

For reference line 25 is the (extend-protocol parse-dates line.

lxsameer22:08:28

is there any attempt to write an alternative to react or preact in pure clojurescript ?

hmaurer22:08:21

doesn’t seem active though

lxsameer23:08:26

I'm no expert on UI, But React contains some features which are not necessary and by creating an alternative in cljs we can take advantage of all the good features which cljs offers

lxsameer23:08:14

but i'm sure that people already thought about this, and there might be a good reason which there is no pure cljs alternative

Oliver George05:08:20

You might like to checkout preact which sounds like a small clutter free rewrite of react. https://github.com/developit/preact

lxsameer07:08:06

Yeah i'm using it

lxsameer23:08:29

and I really like to know the reason

sundarj23:08:10

probably the same reason people don't go reinventing Java libraries in Clojure - if a well-tested, well-documented library already exists, not much point redoing it unless there are exceedingly good reasons for doing so. otherwise, it could just be that no one has cared to.

sundarj23:08:19

if you wanted to, though, writing a wrapper around (or port of), say, https://github.com/snabbdom/snabbdom couldn't hurt