Fork me on GitHub
#clojurescript
<
2015-09-07
>
bmaddy02:09:47

@phil_r: (re: my datascript issue) Just updating figwheel didn't work for me. With the help of jaen over in #C07V8N22C I figured out the specific versions of things I needed to get it to work: https://github.com/bmaddy/prochaine/commit/09aa87e8327ada5b7e2d821f6e8b08a12ad1961e Thanks again for taking a look!

wildermuthn02:09:08

@bhauman, maybe vim + ClojureScript + figwheel is such an edge case that there isn’t much demand for a solution?

wildermuthn02:09:37

That, and vimscript isn’t on the top of people’s list of languages to learn.

underplank03:09:44

hmm.. anybody got an idea why this is happening

Marks-MacBook-Pro:opplz underplank$ lein figwheel
java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Named
 at clojure.core$name.invoke (core.clj:1518)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invoke (core.clj:626)
    clojure.core$update_in.doInvoke (core.clj:5698)
    clojure.lang.RestFn.invoke (RestFn.java:445)
    figwheel_sidecar.config$apply_to_key.invoke (config.clj:117)
    figwheel_sidecar.config$fix_build_options.invoke (config.clj:164)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invoke (core.clj:626)
    clojure.core$update_in.doInvoke (core.clj:5698)
    clojure.lang.RestFn.invoke (RestFn.java:445)
    figwheel_sidecar.config$fix_build.invoke (config.clj:187)
    clojure.core$mapv$fn__6311.invoke (core.clj:6353)
    clojure.lang.ArrayChunk.reduce (ArrayChunk.java:63)
    clojure.core.protocols/fn (protocols.clj:98)
    clojure.core.protocols$fn__6057$G__6052__6066.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invoke (protocols.clj:31)
    clojure.core.protocols/fn (protocols.clj:60)
    clojure.core.protocols$fn__6031$G__6026__6044.invoke (protocols.clj:13)
    clojure.core$reduce.invoke (core.clj:6289)
    clojure.core$mapv.invoke (core.clj:6353)
    figwheel_sidecar.config$fix_builds.invoke (config.clj:190)
    figwheel_sidecar.config$prep_builds.invoke (config.clj:273)
    leiningen.figwheel$figwheel.doInvoke (figwheel.clj:75)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invoke (core.clj:626)
    leiningen.core.main$partial_task$fn__6071.doInvoke (main.clj:253)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invoke (core.clj:626)
    leiningen.core.main$apply_task.invoke (main.clj:303)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:309)
    leiningen.core.main$_main$fn__6136.invoke (main.clj:377)
    leiningen.core.main$_main.doInvoke (main.clj:366)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invoke (core.clj:624)
    clojure.main$main_opt.invoke (main.clj:315)
    clojure.main$main.doInvoke (main.clj:420)
    clojure.lang.RestFn.invoke (RestFn.java:436)
    clojure.lang.Var.invoke (Var.java:388)
    clojure.lang.AFn.applyToHelper (AFn.java:160)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)

danielcompton04:09:34

@underplank: can you post your figwheel config? It looks like you’ve put a list in place of a symbol

underplank04:09:55

@danielcompton:

{:id "dev"
             :source-paths ["src/cljs" "src/cljc" "env/dev/cljs" "test/cljs"]
             :figwheel true
             ;; {:css-dirs ["resources/public/css"]             ;; watch and update CSS
             ;;                 :on-jsload "opplz.dev/main"}
                  :compiler     {:main           "opplz.dev"
                                 :asset-path     "/js/compiled/out"
                                 :output-to      "resources/public/js/compiled/app.js"
                                 :output-dir     "resources/public/js/compiled/out"
                                 :source-map     "resources/public/js/compiled/out.js.map"
                                 :optimizations  :none
                                 :cache-analysis true
                                 :pretty-print   true
                                 :source-map-timestamp true}}

underplank04:09:02

is that what you wanted?

nikp04:09:22

@underplank: the figwheel config looks fine to me. Just a hunch, but it may be a typo somewhere in the project file. I came across a similar-ish ClassCastException when I had a typo in a project.clj and was trying to use lein run

underplank04:09:11

@nikp: thanks. i'll have a look around and see if I can find something like that. although its wierd that its only happening when starting figwheel, not doing a cljsbuild or anything else.

underplank05:09:23

@nikp: thanks for the pointer. worked out it was a quoted namespace that was messing it up, from one of the other build targets.

nikp05:09:16

@underplank: ahhh okay. Glad you worked it out

phil_r07:09:38

@bmaddy: yeah i was trying to reduce it to the smallest change to your project.clj that made it work, but i think i forgot a lein clean somewhere inbetween, sorry simple_smile

phil_r08:09:28

@wildermuthn: I use vim + figwheel for cljs; you can make it work if you use a version of fireplace from https://github.com/tpope/vim-fireplace/pull/222

phil_r08:09:55

but to be honest I almost never turn it on, figwheel is great for me on its own (thanks @bhauman!)

darwin08:09:41

I’m wondering if it is possible to set some of my namespace(s) as implicit in my lein project, so I don’t have to require/prefix them in all files

jonpither09:09:06

Anyone got example code of Mustache + ClojureScript?

darwin09:09:59

I have just created a new library and I want to use the trick where macros ns and library ns have the same name so the consumer does not have to include macros explicitly. I was unable to make it work. I see that Om uses it, but I wasn’t able to setup my repo to do the same thing. Help would be much appreciated, here is my code: https://github.com/binaryage/cljs-plate

darwin09:09:14

ah, nevermind, it does not work with :require :refer, it works when doing :require :as

a.espolov10:09:12

I have a js js/Image object, I do not understand how it render in IRender/IRenderState

borkdude11:09:34

a.espolov: Render works against the virtual dom. What you have is a real dom element

borkdude11:09:02

a.espolov: you could insert it using will-update or something

a.espolov11:09:11

@borkdude How to insert? What is this notation?

borkdude11:09:55

@a.espolov: or actually, did-update

a.espolov11:09:43

Ok. I realized where I can insert your js/Image, but I was early I will not understand how to do it? Insert directly into the dom?

borkdude11:09:10

@a.espolov: just use jquery or however you would like to do it. You can also use a ref. This is all I can say about, without repeating documentation.

amithgeorge11:09:10

@a.espolov: their doc talks about accessing the dom directly - https://facebook.github.io/react/docs/working-with-the-browser.html. That might give you some ideas.

timgilbert15:09:17

@darwin, I’ve started using .cljc files for macros I’m going to use in ClojureScript, you wind up getting the empty .cljs namespace for free without having an extra file in there.

darwin15:09:16

@timgilbert: thanks, will try

mfikes16:09:28

@timgilbert: That's cool. The one thing I also wonder is whether you can do this in bootstrapped ClojureScript as well. I think to be portable there you need .cljs for the main ns and .cljc for the macros ns. And to be portable to Clojure, you need to simply put your macros in a differently-named ns.

pupeno16:09:50

I managed to implement server side prerendering of my reagent/re-frame single page application, but running JS on the server is quite slow. I’m wondering whether I should white-list the well known browsers and skip it for them, since they don’t really need it.

whacked20:09:49

@darwin any progress with your boilerplate project? I've been trying to get macros to work correctly today, failing after 2 hours and counting

whacked20:09:26

FYI I'm using the chestnut template, which starts with a src/{cljs,clj}/projectname structure

whacked20:09:13

so far, it seems like macros aren't getting pulled regardless of whether I put the file in cljs nor clj, and regardless of the file extension

whacked20:09:39

I'll try out your repo now

darwin20:09:08

@whacked It works for me, I just have to reference the macros using :require :as, not :require :refer

whacked20:09:30

@darwin oh I see what your original question meant now

darwin20:09:44

@whacked: so your problem is different?

whacked20:09:17

yeah, mine is simpler: I simply can't get local macros to work in cljs

darwin20:09:33

maybe you didn’t set proper paths into lein’s project.clj? both :source-paths and :cljsbuild :builds … :source-paths are important

whacked20:09:58

I will try the cljc route now

darwin20:09:38

top-level source-paths is for macros (via clojure), cljsbuild paths are for clojurescript files

darwin20:09:15

usually you want to set all source-paths to the same thing, see om: https://github.com/omcljs/om/blob/master/project.clj

darwin20:09:26

have to go, good luck

val_waeselynck20:09:02

is datascript known to be slow from JavaScript, I get very long read times even for a few hundreds datoms

whacked21:09:42

@darwin ugh I got it. It appears that macros must be syntax-quoteed. My toy examples all looked like (defmacro [x] x) and those were failing

whacked21:09:26

supposed to be obvious? 😕

martinklepsch21:09:16

is there an agreed upon form of saying "clojure and clojurescript"? Clojure/Script?

emil0r21:09:39

@martinklepsch: Clojure(Script) is the one I've seen the most

venantius22:09:22

Is anybody doing any ClojureScript work with standard JS templating languages? Something like combining Om with Jade? Is that a thing?