Fork me on GitHub
#clojurescript
<
2016-12-23
>
futuro00:12:45

@sova check out the #om room if you haven't already

futuro00:12:01

@sivertsenstian it's hard to say without seeing the code you're using to send the message, but my guess is that the message is malformed

futuro00:12:54

Reading the piggyback wrap-cljs-repl source seems to imply that if it's working from terminal, then you're environment should be set up correctly and the only thing left to check is the message being sent

dhruv105:12:53

hey, how can i use external fonts in my clojurescript project? I am looking to use font awesome http://fontawesome.io/icons/

dhruv105:12:16

i couldn’t find much info online

shaun-mahood06:12:51

@dhruv1: The same as any other HTML element - is there something particular that you are struggling with?

Pablo Fernandez09:12:21

What’s the CLJS equivalent of import React from ‘react’; ?

dhruv115:12:18

@shaun-mahood I am not sure how to call them in my CLJS code.

dhruv115:12:42

possible for you to give me an example?

shaun-mahood15:12:42

@dhruv1: Using reagent and google material icons, you include your icon file in the HTML (https://github.com/smahood/re-frame-conj-2016/blob/master/show/resources/public/index.html#L6), and then render the image (https://github.com/smahood/re-frame-conj-2016/blob/master/show/src/show/core.cljs#L96) and value (https://github.com/smahood/re-frame-conj-2016/blob/master/show/src/show/core.cljs#L99) with whatever CLJS rendering library you are using - font awesome would follow the same pattern, just adjust to match your needs. Hope that helps, let me know if you want clarification on anything.

dhruv115:12:28

@shaun-mahood thank you very much I’ll have a look and let you know if i need clarifications.

sivertsenstian22:12:14

Thanks @futuro, after some more experimenting (using a separate repl to send msgs) it looks like the "clojurescript session "(?) is not targeted when sending a regular eval op msg, if i send a msg to receive the running sessions and send an eval to the correct session (found it by guessing), it evaluates correctly.

sivertsenstian22:12:46

Does anyone know how I can identify the running clojurescript-session remotely in an nrepl?

sivertsenstian22:12:37

if i send a msg with the op 'ls-sessions' i get a list of guids returned with the running sessions in an nrepl, but I'm not sure what the best way to determine what session the cljs-repl is running on is

darwin22:12:01

@sivertsenstian it should be the session where you called piggieback’s cljs-repl, maybe you could store session id at that point and provide it later where needed?

sivertsenstian22:12:15

yeah that might be a good idea, im trying to connect from javascript so it might also be possible to initiate piggieback from there? I should get the session automatically, or atleast in return then? Otherwise ill try storing it and finding it again remotely

darwin22:12:00

hmm, are you connecting from javascript running in node.js?

darwin22:12:24

I’m not sure if I understand, maybe look here: https://github.com/binaryage/dirac/blob/master/docs/about-repls.md I jumped through many hoops to implement a cljs nREPL client in the browser in Dirac

darwin22:12:40

ended up needing a fork of piggieback

darwin22:12:02

AFAIK by calling cljs-repl you are not creating a new nREPL session, you switch regular clojure nREPL session into cljs-enabled session, hence the name “piggieback” - you piggyback on an existing session

sivertsenstian22:12:25

yeah thats why i thought I would be able to send messages to the repl directly, but for some reason I am unable to reach the cljs-repl this way

sivertsenstian22:12:11

I want to create an extension to vscode to evaluate and navigate cljs code

darwin22:12:29

nice idea! 🙂

darwin22:12:06

meaning of “eval” nREPL message is redefined once piggieback successfully initializes

sivertsenstian22:12:07

Im using nodes nrepl-client to test now, but I think im gonna implement the communication in the extension directly so I have more control

darwin22:12:18

until you send “eval” :cljs/quit

darwin22:12:29

then it drops back to clojure mode

sivertsenstian22:12:39

but only if i start the piggieback from nodejs?

sivertsenstian22:12:59

because i tried starting a lein repl, and running piggieback manually using (cemerick.piggieback/cljs-repl (cljs.repl.rhino/repl-env))

sivertsenstian22:12:24

and I can only reach the clojure-repl when communicating, unless i specify the session

darwin22:12:02

if I remember well, you get a new pristine session if you don’t specify one

sivertsenstian22:12:39

very nice repl-overview you got there 🙂 Should help understand what Im doing hehe

darwin22:12:08

yep, I wish I had this when I started 🙂

sivertsenstian22:12:30

yeah I read on piggieback something about persisten REPL sessions but I dont really know what it means

sivertsenstian22:12:36

but it might be the reason why Im having some issues

sivertsenstian22:12:00

"Piggieback depends upon persistent REPL sessions, like those provided by clojure.tools.nrepl.middleware.session/session.)"

sivertsenstian22:12:35

does that just mean that I have to manually handle the sessions Im using, or is there some functionality that can do this for me?

darwin22:12:48

yes, I read it as “piggieback stores its cljs-session state in clojure’s nREPL session"

darwin22:12:26

so without a session middleware it won’t work for more than one cljs-session per nREPL server

darwin22:12:52

I’m not aware of any other/alternative session middleware implementation

darwin22:12:30

ad "does that just mean that I have to manually handle the sessions Im using, or is there some functionality that can do this for me?” I think you simply have to specify session-id for all your messages and stay within one session

darwin23:12:11

this is pretty complex topic, it really depends what exactly are you trying to do, you might want to support multiple sessions (e.g. each window having its own separated REPL state)

darwin23:12:34

or one session for background code evaluation for IDE purposes, etc.

sivertsenstian23:12:11

yeah getting the cljs code evaluated from nodejs was much more complex than I would have thought

sivertsenstian23:12:29

so ill start with 1 repl/session and see where that gets me

darwin23:12:18

you should be able to create a new clojure nREPL session using “clone” command, it gives you session-id back

darwin23:12:37

then you are in regular clojure nREPL session, where you can “boot” piggieback and enter cljs mode

darwin23:12:51

since then you are able to “eval” cljs code, instead of clj code

darwin23:12:16

if you ever needed to go back, you can eval :cljs/quit and drop back

darwin23:12:57

in theory you should be able to boot piggieback again in the same nREPL session and repeat it

darwin23:12:35

but I don’t think you need it, you just create sessions you need and then use them until you no longer need them

sivertsenstian23:12:33

thanks again for the help @darwin 👍