This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-23
Channels
- # ai (1)
- # beginners (84)
- # boot (111)
- # cider (2)
- # cljsrn (9)
- # clojure (245)
- # clojure-italy (2)
- # clojure-mke (1)
- # clojure-russia (6)
- # clojure-spec (92)
- # clojure-uk (32)
- # clojurescript (55)
- # core-async (1)
- # cursive (8)
- # datomic (19)
- # events (1)
- # hoplon (379)
- # lambdaisland (4)
- # lein-figwheel (8)
- # off-topic (115)
- # om (18)
- # om-next (5)
- # onyx (25)
- # re-frame (8)
- # reagent (5)
- # ring-swagger (1)
- # rum (19)
- # schema (3)
- # untangled (24)
@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
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
hey, how can i use external fonts in my clojurescript project?
I am looking to use font awesome
http://fontawesome.io/icons/
@dhruv1: The same as any other HTML element - is there something particular that you are struggling with?
What’s the CLJS equivalent of import React from ‘react’; ?
@shaun-mahood I am not sure how to call them in my CLJS code.
@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.
@shaun-mahood thank you very much I’ll have a look and let you know if i need clarifications.
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.
Does anyone know how I can identify the running clojurescript-session remotely in an nrepl?
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
@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?
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
thanks!
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
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
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
I want to create an extension to vscode to evaluate and navigate cljs code
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
but only if i start the piggieback from nodejs?
because i tried starting a lein repl, and running piggieback manually using (cemerick.piggieback/cljs-repl (cljs.repl.rhino/repl-env))
and I can only reach the clojure-repl when communicating, unless i specify the session
very nice repl-overview you got there 🙂 Should help understand what Im doing hehe
yeah I read on piggieback something about persisten REPL sessions but I dont really know what it means
but it might be the reason why Im having some issues
"Piggieback depends upon persistent REPL sessions, like those provided by clojure.tools.nrepl.middleware.session/session.)"
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?
yes, I read it as “piggieback stores its cljs-session state in clojure’s nREPL session"
so without a session middleware it won’t work for more than one cljs-session per nREPL server
here is the code for session middleware: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/session.clj
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
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)
yeah getting the cljs code evaluated from nodejs was much more complex than I would have thought
so ill start with 1 repl/session and see where that gets me
you should be able to create a new clojure nREPL session using “clone” command, it gives you session-id back
then you are in regular clojure nREPL session, where you can “boot” piggieback and enter cljs mode
in theory you should be able to boot piggieback again in the same nREPL session and repeat it
but I don’t think you need it, you just create sessions you need and then use them until you no longer need them
thanks again for the help @darwin 👍