Fork me on GitHub
#clojurescript
<
2020-05-25
>
Old account10:05:34

What is the common way to work with web designers? As far as I understand they produce html and css + etc. and I would have to translate the html to Hiccup? I am about to hire a web designer, but I don't know much about it. Please advice :)

Litewhat11:05:31

Hey everyone 👋 I'm going to use https://cljs.github.io/api/cljs.reader/read-string. Do you know any potential security issues I could encounter, e.g. code execution?

Andreas S.11:05:30

What is the best clojurescript getting started guide besides this: https://clojurescript.org/guides/quick-start ?

didibus00:05:06

The figwheel-main tutorial is pretty good as well: https://figwheel.org/tutorial

Pinchas Laivich13:05:09

Hello, I am trying to get started with Calva VS Code plugin + lein re-frame template, but having some trouble 😞

Pinchas Laivich13:05:27

I run lein new re-frame reframe-app

Pinchas Laivich13:05:57

Then "Calva: Start a project REPL and connect (Jack-in)"

Pinchas Laivich13:05:18

Select "shadow-cljs" and ":app" build

Pinchas Laivich13:05:55

REPL prompts me whether to connect to :app, node-repl, browser,repl, I select "🍎 "

Pinchas Laivich13:05:00

I visit localhost:8080 and I get the default re-frame message. The websocket connection is good

Pinchas Laivich13:05:06

Then I run "Calva: Load Current Files and Dependencies"

Pinchas Laivich13:05:41

And get: Evaluating file: filename.cljs No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code. No results from file evaluation.

Pinchas Laivich13:05:08

I get the same error when running "Calva: Evaluate Current Form"

orestis13:05:10

@stebokas If you’re working with web designers that produce HTML/CSS, you can use other templating libraries like Selmer or Enlive to make HTML dynamic, but this is only for server-rendered HTML.

✔️ 4
Pinchas Laivich13:05:51

There is a GH issue for that specific lein template, but everyone says that you just need to load up the browser first. I tried that, and it's still not working 😞

thheller13:05:25

try running shadow-cljs cljs-repl app from the command line and just eval 1 or so

thheller13:05:42

don't know about calva but if that fails too I might be able to help

Pinchas Laivich13:05:36

Thanks for the reply! I tried running it manually w/the command you provided and get the same error: ⇒ shadow-cljs cljs-repl app shadow-cljs - config: /home/user1/development/clojure/re-frame-proj/shadow-cljs.edn shadow-cljs - running: lein run -m shadow.cljs.cli --npm cljs-repl app shadow-cljs - HTTP server available at http://localhost:8280 shadow-cljs - server version: 2.9.3 running at http://localhost:9630 shadow-cljs - nREPL server started on port 8777 cljs.user=> (println "asdf") No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code. cljs.user=> (1) No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code. cljs.user=>

thheller13:05:56

ok what does the browser console say exactly?

thheller13:05:11

should say 🠶 shadow-cljs: WebSocket connected!?

thheller13:05:50

also you said you visited localhost:8080 but the above also starts a webserver at :8280?

thheller13:05:56

are you maybe just on the wrong server?

Pinchas Laivich13:05:58

Installing CLJS DevTools 1.0.0 and enabling features :formatters :hints :async :8280/js/compiled/cljs-runtime/module$node_modules$react_dom$cjs$react_dom_development.js:796 Download the React DevTools for a better development experience: https://fb.me/react-devtools :8280/js/compiled/cljs-runtime/cljs.core.js:175 dev mode :8280/js/compiled/cljs-runtime/devtools.util.js:240 CLJS DevTools: some custom formatters were not rendered. https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#why-some-custom-formatters-were-not-rendered

Pinchas Laivich13:05:06

OOps, that was a typo

thheller13:05:30

ehm hang on

thheller13:05:56

you don't seem the have shadow-cljs running at all?

thheller13:05:04

> shadow-cljs - running: lein run -m shadow.cljs.cli --npm cljs-repl app

thheller13:05:10

this should have said "connected to server"

thheller13:05:24

do you have lein dev running?

thheller13:05:53

or shadow-cljs watch app?

thheller13:05:23

I do not know what calva does ...

thheller13:05:39

you may just have 2 competing shadow-cljs instances running? but the messages above indicate that it doesn't even try to connect anywhere

Pinchas Laivich14:05:56

Sorry battery died. I will give that a shot

Pinchas Laivich14:05:51

This is odd, so when I run lein run -m shadow etc I get the same error when trying to use REPL

Pinchas Laivich14:05:59

The calva stuff just runs " npx shadow-cljs -d cider/cider-nrepl:0.23.0 watch :app"

Pinchas Laivich14:05:31

Just tried lein dev by itself, get the same issue, I guess it

Pinchas Laivich14:05:47

*it's a problem with Calva 😕

pez08:05:46

It just works when I do this… It would be awesome if I could see what is going on (or not) in your setup.

Andreas S.13:05:09

hi @thheller nodeJS as a dependency is not a option for me

p-himik14:05:09

Even as a dev-time dependency?

Andreas S.07:05:03

where can I find a list of current possible development approaches with clojureScript? does such a list exist?

thheller07:05:20

why is it not an option? at some point you may want to access JS dependencies that are only available via npm? not just with shadow-cljs. also with the new :bundle stuff going through webpack or similar

thheller07:05:15

you can limit yourself and never access npm but since you already tried going through the quickstart react-dom example that would already involve npm packages

thheller07:05:56

sure there are fairly stable CLJSJS versions for that but CLJSJS becomes more unreliable the more packages you want to use

thheller07:05:33

I'm not aware of such a list though. the most common setups are shadow-cljs, figwheel-main, lein-figwheel+lein-cljsbuild. raw cljs.main if you want something more basic.

Andreas S.07:05:26

thank you thheller!

Andreas S.07:05:56

Why is it that "CLJSJS becomes more unreliable the more packages you want to use"?

thheller08:05:31

https://clojurescript.org/news/2020-04-24-bundle-target I'd expect CLJSJS to be left behind as more people move to using npm directly instead

Andreas S.09:05:39

so shadow is the only way if I want to use js dependencies correctly?

thheller09:05:59

no, the :bundle stuff gets you the same access but you have to also use a secondary JS build tool like webpack

mh.meraji15:05:56

Hi. I run my clojure-script code with shadow-cljs when ever there is a bug in the code (especially functions for view) the page completely goes out (I get a white blank page) and some error pops up on the console Is there any method to avoid losing the whole page despite of the exceptions thrown on different parts of the code? In other words what are the best practices for this kind exception handling for these situation? Thanks.

dpsutton15:05:23

if you're using react normally react says you can use an error boundary

mh.meraji15:05:10

Does re-frame has any equivalent for react error boundry? or is it implemented in re-frame?

dpsutton15:05:57

i don't believe so

dpsutton15:05:58

but it seems its just some lifecycle methods

mh.meraji16:05:25

Thanks alot.