Fork me on GitHub
#clojurescript
<
2019-01-14
>
ghadi01:01:16

update: It was the :preloads [rebl.browser] that interfered with the preloads the cljs.main -r added

mfikes01:01:58

FWIW, we have a site update that will help clarify which options on the REPL options page go into compiler options https://github.com/clojure/clojurescript-site/pull/258

mseddon11:01:00

Is there a way I can get figwheel to reload when I change a file in my resources directory? I want to load a text file containing a WebGL shader (e.g. by slurp inside a macro), and would like hot-reload to still work in this case. (I'm using figwheel-main)

victorb13:01:50

@mseddon I have this option for when I change my css :figwheel { :css-dirs ["resources/public/css"]}

victorb13:01:16

must be some other key as well that does general when this resource change, call "on-js-reload"

orestis15:01:00

I just wrote a translation macro that collects all usages of static strings, then at the end of the compilation phase spits out a gettext .pot file. Everything seems to be working very nicely, should I feel dirty that I my macro uses an atom ??

thheller15:01:17

@orestis yes, very dirty. it completely breaks caching.

orestis15:01:39

I’ve added the namespace to my cache breakers though :)

thheller15:01:56

well yeah but thats basically turning off cache, that is not nice either 😉

orestis15:01:44

In most cases I can imagine, I would like to do this job whenever I release the code anyway. So I don’t care at all for this in development mode, but for release it saves me doing a post-process on the files.

thheller15:01:18

the closure compiler has some options to do translations and related things. still need to expose those properly in shadow-cljs

victorb16:01:26

"closure compiler has some options to do translations" do you have any link for more info about this?

thheller16:01:35

some of it is in the wiki some is just in the code

thheller15:01:50

macro is fine if you can live without cache

orestis15:01:36

Yeah I investigated that - something to do with getMsg which would be nice to have. I’m using the ICU MessageFormat for now, which is nice but Closure only has limited functionality for it... so I might go to something else in the end.

tomaas17:01:57

hi, compiling our reagent project with clojurescript version 1.10.439 o even some version lower than this, we get Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/Streams. Meanwhile we got back to an older one (1.9.946) where everything compiles well. Any ideas how to fix that error?

thheller17:01:40

@tomaas thats caused by a version conflict on the guava lib. try to resolve that.

tomaas18:01:57

@thheller I've excluded guava everywhere lein deps :tree was suggesting but still get the same error

dpsutton18:01:52

there's a way to include plugins in the deps computation. not sure what it is though

thheller18:01:39

@tomaas you are probably excluding the wrong version. try to use the version the closure-compiler wants

thheller18:01:21

should be [com.google.guava/guava "25.1-jre"], can just add it manually do your deps to avoid getting a different version

tomaas18:01:19

@thheller thank you. that worked

richiardiandrea18:01:21

hello folks! is there any lib that does what clj->js is doing but with a :depth param or something for controlling how nested it should go?

richiardiandrea18:01:41

basically like util.inspect

Daniel Hines20:01:14

I want to throw a clojurescript datastructure into a function and get a dom that I can visualize it with, kinda like this: https://www.npmjs.com/package/react-json-tree. Is there a library that does this? I could also convert it to json first, which is quite tempting.

darwin20:01:50

cljs-devtools given a cljs value can provide you JsonML representation, but you would have to render it yourself

lilactown20:01:54

yep, frisk is nice.

borkdude20:01:17

I used it primarily for debugging, now I use re-frisk which integrates with re-frame

Daniel Hines20:01:23

That’s perfect. I’ve seen that before, I just couldn’t remember it.

lilactown20:01:16

I'm also working on something similar to REBL for CLJS that I think fits this niche quite nicely too. should be releasable soon-ish 😜

borkdude20:01:28

I still have to try out REBL…

borkdude20:01:35

I haven’t even seen the talk yet…

lilactown20:01:51

working on data-heavy back-end systems, it's reaaallly nice

lilactown20:01:22

way betting then pprinting and trying to have CIDER handle it, or using the Emacs inspector, like I have in the past

lilactown20:01:47

plus, the whole datafy/nav business. I would check out the talk 😉

lilactown20:01:36

the beginning is kind of slow but the payoff is near the middle / end when stu explains how datafy and nav fit into this and the actual tool itself

lilactown20:01:51

that being said, I haven't used REBL for anything other than a replacement for pretty-printing

dnolen20:01:52

I think using REBL mostly for data navigation is already a game changer

dnolen20:01:10

I won't miss pretty-printing

dpsutton20:01:22

this sounds like my friday afternoon this weekend then. setting this up. does it work with cljs yet or is it just for clj right now?

lilactown20:01:41

CLJ only atm

borkdude20:01:51

when I use .setQuery from Google Closure to set a query string to a Uri I notice that it doesn’t encode (, ) and +, why is that?

dnolen20:01:10

probably because it just doesn't encode by default?

borkdude20:01:24

it does encode spaces, etc.

borkdude21:01:16

should I encode parens in query parameters? I forgot why I did it in the first place

borkdude22:01:08

I remember why encoded those parens now.

dpsutton22:01:17

you have to provide a reason now 🙂

borkdude22:01:37

Twitter does not like links that end with a paren, it chops it off.

borkdude22:01:34

I wanted to tweet this example, but that didn’t work when I removed the encoding of parens: https://re-find.it/?args=%2B%20%5B1%202%203%5D&amp;ret=%28%2B%201%202%203%29

dpsutton22:01:36

maybe use a trailing character on parens? (, -> ( and ), -> ). You might not even have to decode that since commas are just whitespace

dpsutton22:01:48

will twitter allow a link that ends with ),?

dpsutton22:01:10

i believe the corfield comma needs more widespread usage

borkdude22:01:48

was it invented by sean corfield?

borkdude22:01:02

I’ll try…

dpsutton22:01:13

like mathematics its difficult to know if it was invented or discovered

borkdude22:01:22

it seems to be especially the case with query params: https://en.wikipedia.org/wiki/Disambiguation_(disambiguation) works but https://en.wikipedia.org/wiki/Disambiguation_(disambiguation)?q=(foo) not, then the last paren gets chopped. Same with trailing comma.

borkdude22:01:50

Easy way to try this out is to private message someone on Twitter

borkdude22:01:16

Github also encodes parens, so I’m in good company I guess ..

borkdude22:01:01

it might be a bug in the http://t.co url shortener

dpsutton22:01:23

i think it would be way nicer if you had more readable url's (just my opinion). Parens are way more prevalent in clojure snippets than github snippets.

borkdude22:01:26

@dpsutton I agree and I’ve thought about it but I haven’t found a nice solution to this

borkdude22:01:58

@dpsutton e.g. you can make up some scheme where you replace chars that normally would be percent encoded with some other char, but what if that other char is in the input?

dpsutton22:01:16

yeah you need something that would never be in the input. maybe ~, !, or something like that

borkdude22:01:08

those chars will be in the query params, like (swap! x #(- % 10))

dpsutton22:01:43

yes but not right after ( or )

dpsutton22:01:06

just a simple string replace (! -> (

borkdude22:01:34

you mean the other way around right? if the user types (foo) the query param will be (!foo)!?

dpsutton22:01:04

yes. so when reading the query string they are easy to strip out

borkdude22:01:51

maybe ~ or ^ will work, since I don’t expect those to be of use… this may work out well

borkdude22:01:37

hmm, ^ is also percent encoded

borkdude23:01:42

@dpsutton spaces and square brackets will also need their unique encoding. I think it gets complicated

dpsutton23:01:16

ah. maybe base64 encode it then?

borkdude23:01:48

it might be nice to have a general library which can encode clojure expressions as pretty url query params. I also tried base64, but these aren’t all pretty to see either and become longer

borkdude23:01:20

KLIPSE could then use this library too. I’ll ask Yonathan if he has ideas about it

borkdude23:01:18

Made an issue for it, in case I get some better ideas: https://github.com/borkdude/re-find.web/issues/67

borkdude09:01:34

The second mapping may be improved, e.g. making up other chars for [, etc.