Fork me on GitHub
#clojurescript
<
2016-11-24
>
Matt Butler11:11:19

Can anyone gives me the simplest approach to cache busting for a cljs reagent app? Is this library the answer? https://github.com/burhanloey/cljs-simple-cache-buster, our index.html (where the app hooks onto) is created by hiccup so not sure how that would interact with this lib. Thanks in advance 馃檪

juhoteperi11:11:31

@mbutler With Hiccup, by far the simplest way is to just append hash in the Hiccup code: (page/include-js (str "js/main.js?v=" (hash/memo-resource-hash "js/main.js"))) where memo-resource-hash reads the resource from classpath and calculates hash using commons codec

juhoteperi11:11:41

No reason to use a build tool for this

Matt Butler11:11:20

@juhoteperi Thanks, I鈥檒l take a look

curlyfry12:11:28

Hi, does anyone have a favorite library for making html canvas animations? I've been looking at https://github.com/rm-hull/monet and https://github.com/quil/quil

miikka13:11:38

Hmh. .getBasis for deftypes is kinda useless when you're advanced-compiling, right?

miikka13:11:53

In that you can't actually look up the fields

chrisetheridge13:11:31

anyone ever used d3 v4 with c3js ?

chrisetheridge13:11:36

i鈥檓 having trouble with the externs, pretty much

chrisetheridge13:11:17

the current cljsjs is v4. but, c3js depends on v3

chrisetheridge13:11:34

i鈥檝e tried manually adding a generate v3 extern, but it did not work

mikebelanger14:11:53

@curlyfry I've used monet a little, it's not bad, kinda limited. Quil is nice is you're already familiar with Processing. You might want to check out the libraries at http://thi.ng

deas14:11:28

Successfully compiled ... in 188.056 seconds

deas14:11:58

Phew! Could that be normal on a half decent notebook?

anmonteiro14:11:58

@deas without any more information: yes

deas14:11:03

@anmonteiro Don't want to bug you guys with the details. Just wondering if that could be normal.

anmonteiro14:11:27

well you didn't say what optimization level you're compiling with, how many dependencies / namespaces

anmonteiro14:11:35

so all I can say is yes, I've seen builds take longer

deas14:11:56

advanced optimization. "seen builds take longer" - guess that's what I was after.

colin.yates14:11:28

@deas just passing through, but if ClojureScript builds are taking a while have a look at https://github.com/clojure/clojurescript/wiki/Compiler-Options#parallel-build. It made a significant difference to my build time

deas14:11:35

@anmonteiro Quite a lot of deps. Resulting file is 2780k.

anmonteiro14:11:11

right, maybe :parallel-build can help, but I'd say that's not where you're spending most time

anmonteiro14:11:33

if it's advanced compilation, you'll be spending the most time in the Closure Compiler pass

anmonteiro14:11:09

the next version of ClojureScript will include more detailed information about how much time it's spent compiling each namespace. cf: https://github.com/clojure/clojurescript/commit/6602f769ed4d52fd67577aacaf9cfe6db05b8ef3

deas14:11:40

Already got parallel-build true set. Again thanks. Just wanted to make sure it is normal. 馃檪

anmonteiro14:11:27

@deas btw if you're looking to shave some KBs off your build there's probably more you can do

anmonteiro14:11:01

namely, setting :elide-asserts true and using a closure-define to set goog.DEBUG to false

anmonteiro14:11:09

(if you're not doing it already)

deas14:11:23

@anmonteiro had goog.DEBUG,trying timing stats and :elide-asserts.

rauh14:11:58

Is the ^boolean type hint on complement correct?

anmonteiro15:11:20

@rauh probably not, as it returns a function

anmonteiro15:11:33

but I don't think it matters in practice

anmonteiro15:11:33

probably each generated function arity should be hinted instead, but I'm not sure

rauh15:11:39

Agreed 3x

borkdude15:11:21

is it possible to change how cljs-ajax encodes arrays as query parameters?

borkdude15:11:56

I get: terms[0]=foo&terms[1]=bar, but this is not something compojure-api understands

pesterhazy15:11:31

@borkdude which style to you expect?

borkdude15:11:54

compojure-api respects ?terms=foo&terms=bar

pesterhazy15:11:27

you may be able to do that by passing [["terms" "foo"] ["terms "bar"]] instead of a map

borkdude15:11:17

I鈥檒l go for POST instead

pesterhazy16:11:17

always a good choice

pesterhazy16:11:24

GET only begets pain

gowder18:11:03

Weird question. Does anyone know of a library to do selmer-style templating for serving static content compiled with CLJS as a frontend-only SPA? I'm thinking of McGyvering something together involving selmer + hickory in a macro to grab json data and templates & spit out hiccup at the compilation stage, to pass to reagent or something. But if someone else has already written a library to do that kind of stunt less ridiculously... :-)

gowder20:11:13

hearing no answers, the mcgyvering proceeds apace. 馃檪 https://github.com/paultopia/jsonmacrodemo

gowder20:11:57

Can anyone think of any reason that this is a stupid thing to do, for static content? my intuition is that it would just make static pages serve blazingly fast...

mitchelkuijpers20:11:40

@borkdude you can fix the very weird behavior of cljs ajax by adding this the option: :interceptors [(ajax/ProcessGet. ajax/params-to-str-alt)] where the ajax import is [ajax.core :as ajax] This would make it: terms[]=foo&terms[]=bar