Fork me on GitHub
#shadow-cljs
<
2023-07-31
>
adham14:07:04

How should I go about using .clj code in my .cljs code? I have

- my
  - app.cljs
  - scrape.clj
scrape.clj contains code I want to run inside app.cljs, how can I do that? Trying (:require [my.scrape]) gives me a "my/scrape.clj" was found on the classpath. Should this be a .cljs file? in the terminal. I was not able to find the proper documentation for this in the guide, it's most likely there but I haven't found it.

thheller14:07:47

it is unclear what you are trying to do. is this supposed to be a macro or what is the intent here?

thheller14:07:01

given the name "scrape" i'd guess the intent is to scrape some website?

thheller14:07:21

so for that you'd need to setup a clj webserver and have the cljs code talk to that over http or websocket

thheller14:07:41

you otherwise cannot just call clj code from cljs as cljs executes in your browser

thheller14:07:04

can't find docs since what you are asking is likely unsupported/unfeasible 😛

adham15:07:12

I want to call a function from the my.scrape name space that -as you concluded- grabs some data from a website, I want to then use reagent to display it in a web page. Thanks for letting me know I can't just call clj code. I found https://www.youtube.com/watch?v=V-dBmuRsW6w which aims to do something close to what I want, I'll watch it and report if I was able to do what I wanted, thank you!

👍 2
thheller15:07:23

yeah that seems to cover the basics