A minimalistic ClojureScript interface to React.js
p-himik 2020-06-12T04:09:27.117400Z

I really doubt that. Try to find the root cause of the issue. is not a function really sounds like a usage error.

valtteri 2020-06-12T04:40:22.117700Z

Fair. ๐Ÿ™‚ I edited my statement โ€œbestโ€ => โ€œeasyโ€.

EmmanuelOga 2020-06-12T09:13:38.121800Z

Sup! I want to just render two spans inside some container: (rdom/render [:div.wrapper [:span "Hello"] [:span "world"]] some-dom-elem). This works allright, but what if I want to remove the :div.wrapper? Can't seem to find a way to render a list of elems without a root element. This is annoying because my html ends up using an unneeded wrapper: <div id="wrapper"><div class="wrapper"><span... etc

EmmanuelOga 2020-06-12T09:19:17.122500Z

Oh, that was easy, I just replace :div with :<> . Perfect, thx!

Daniel Hutzley 2020-06-12T22:09:31.124800Z

Hey, I am having some trouble building a release binary. From a fresh install of the template, how would I build a html webpage that I can move onto a server and use?


@endergeryt if it's a lein template, use lein uberjar to create a fat jar, the resulting jar (there's two, you want the one with "standalone" in the name) can be run via java -jar ...

Daniel Hutzley 2020-06-12T22:14:24.126900Z

When I run the uberjar, it drops me into a clojure REPL


oh - it must be avoiding aot

Daniel Hutzley 2020-06-12T22:15:31.128Z

How would I prevent that?


try java -jar my-standalone.jar -m my.ns


you don't need aot, it just means your startup is slightly more verbose a command line

Daniel Hutzley 2020-06-12T22:18:04.129800Z

whenever I do that, it appears to only be looking for clojure and cljc files, but not cljs files

Daniel Hutzley 2020-06-12T22:18:24.130100Z

I should note that I'm using the frontend template


to run cljs files, you need to connect to the clj server


perhaps you want electron rather than reagent if what you want is an app?


Daniel Hutzley 2020-06-12T22:19:49.132600Z

It's a website, I just used the frontend template. How would I get the clj server running? It works with figwheel


running the main ns created by the template (named based on your creation args) will by default start a web server that serves html providing your reagent cljs app


figwheel is a dev only tool and shouldn't be used in production

Daniel Hutzley 2020-06-12T22:22:00.134400Z

ok, where would the main namespace be located in my sources?


if you created it via lein new reagent foo it would be in src/foo/core.clj if you used lein new reagent it would be in src/org/foo/bar.clj

Daniel Hutzley 2020-06-12T22:25:41.136300Z

Hm, is there a way to move from the reagent-frontend template to the plain reagent template easily?


oh! I missed that you were using the separate reagent-frontend package, sorry


if you use lein new, there should be very few files to copy over from the other project, that's likely the easiest thing

Daniel Hutzley 2020-06-12T22:28:16.138200Z

Ok, I'll try to create a reagent standard template and transplant the files


I think the main thing is that src/foo.cljs in reagent-frontend becomes src/cljs/foo.cljs in reagent

Daniel Hutzley 2020-06-12T22:33:47.139200Z

How would I get it to not use the router


why would you need it to do that?

Daniel Hutzley 2020-06-12T22:34:45.140500Z

The way the site is constructed is that it uses an atom to control where it is on the site

Daniel Hutzley 2020-06-12T22:34:59.140800Z

Unless the router can modify the atom


sounds like you just want a single page

Daniel Hutzley 2020-06-12T22:35:22.141200Z

yeah, that's how I set it up


easiest thing is to use only one route in the router


you can run without a router, but that's definitely not the easy thing to do


even with a SPA you usually end up with routes for serving data queries


anyway, now that I think for a moment longer, the router implements a function, you can just replace it with any other function from request -> response (eg. your page handler), or just have no routes defined and serve everything via static resources (but at that point why even use clojure on the back end, maybe you'd want nginx instead...)

Daniel Hutzley 2020-06-12T22:43:04.144900Z

how do I get it to serve cljs instead of the hiccup?


the original project should have had an http template that pulled in the js from your cljs, and rendered the hiccup

Daniel Hutzley 2020-06-12T22:44:25.145800Z



this is the file in reagent-frontend-template: I guess the version in reagent compiles from hiccup in the handler ns - but no hiccup should reach the browser

Daniel Hutzley 2020-06-12T23:00:56.148700Z

how would I configure somethiing to just serve it, since I just need it set up as a single page webapp. I just cannot figure out how to compile the frontend into something I can render

lilactown 2020-06-12T23:08:39.149400Z

@endergeryt it looks like the reagent-frontend project has a command to bundle up all of your JS

Daniel Hutzley 2020-06-12T23:08:49.150Z

Ok, what would that be?

lilactown 2020-06-12T23:08:54.150200Z

in the README

lilactown 2020-06-12T23:09:18.150700Z

> Building for production

lein clean
 lein package

lilactown 2020-06-12T23:09:38.151200Z

that will build a production JS bundle, which you can then upload to a file hosting service

Daniel Hutzley 2020-06-12T23:09:49.151400Z

ok, thanks!


oh wow, I really was sending this on a wild goose chase, sorry

Daniel Hutzley 2020-06-12T23:11:28.153100Z

It's fine, honestly I probably wasn't helping the situation much. Thanks for the help!

Daniel Hutzley 2020-06-12T23:14:48.153700Z

What do I do about the stuff in the index.html file? Do I include that too?

lilactown 2020-06-12T23:32:31.154Z

yeah, you can upload that as well if it matches what you want in production

Daniel Hutzley 2020-06-12T23:40:43.154800Z

Um, slight problem. Whenever I try and run the index.html file in the browser, I get the ClojureScript has not been compiled div instead of the real app

lilactown 2020-06-12T23:45:09.155100Z

could be a number of issues. is your JS bundle being loaded?

Daniel Hutzley 2020-06-12T23:45:54.155500Z

how can I check if that is the case? The script tag is there

Daniel Hutzley 2020-06-12T23:48:53.156100Z

I think it's a problem of it trying to run from the root of my filesystem, how do I avoid that

Daniel Hutzley 2020-06-12T23:51:40.156800Z

Yeah, it's just my links trying to go from the root of my filesystem

lilactown 2020-06-12T23:54:08.157100Z

it would say in the console or network tab if the script failed to load

Daniel Hutzley 2020-06-12T23:56:01.157500Z

Yeah, I've figured out the issue. I got it working. Thanks though!