I really doubt that. Try to find the root cause of the issue.
utils.date is not a function really sounds like a usage error.
Fair. 🙂 I edited my statement “best” => “easy”.1👍
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
Oh, that was easy, I just replace
:<> . Perfect, thx!
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 ...
When I run the uberjar, it drops me into a clojure REPL
oh - it must be avoiding aot
How would I prevent that?
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
whenever I do that, it appears to only be looking for clojure and cljc files, but not cljs files
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?
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
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 org.foo/bar it would be in
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
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
How would I get it to not use the router
why would you need it to do that?
The way the site is constructed is that it uses an atom to control where it is on the site
Unless the router can modify the atom
sounds like you just want a single page
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...)
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
this is the file in reagent-frontend-template: https://github.com/reagent-project/reagent-frontend-template/blob/master/resources/leiningen/new/reagent_frontend/public/index.html I guess the version in reagent compiles from hiccup in the handler ns - but no hiccup should reach the browser https://github.com/reagent-project/reagent-template/blob/master/resources/leiningen/new/reagent/src/clj/reagent/handler.clj
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
@endergeryt it looks like the
reagent-frontend project has a command to bundle up all of your JS
Ok, what would that be?
in the README
> Building for production
lein clean lein package
that will build a production JS bundle, which you can then upload to a file hosting service
oh wow, I really was sending this on a wild goose chase, sorry
It's fine, honestly I probably wasn't helping the situation much. Thanks for the help!
What do I do about the stuff in the index.html file? Do I include that too?
yeah, you can upload that as well if it matches what you want in production
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
could be a number of issues. is your JS bundle being loaded?
how can I check if that is the case? The script tag is there
I think it's a problem of it trying to run from the root of my filesystem, how do I avoid that
Yeah, it's just my links trying to go from the root of my filesystem
it would say in the console or network tab if the script failed to load
Yeah, I've figured out the issue. I got it working. Thanks though!