Fork me on GitHub

I currently have a #reagent project with a landing page and an “app” page. The landing page only makes use of Reagent to create a simple modal. I want to pre-render the landing page for better SEO and pagespeed score. I currently use #reitit for client side routing. There is currently no backend. How would you recommend I go about this? I heard that #rum could be a possible way forward?


I would switch to Rum. I have used reagent for ~3 years and quite liked it for its ease of use, but I prefer Rum now even it is a little more involved. Rum also uses Hiccup and is like 99% compatible with reagent’s Hiccup, so the actual lines of code that need to change shouldn’t be too numerous. My preferred cljc stack is Rum + Pedestal


Alternatively, if you won't change that modal too often and if it doesn't share a lot of code with the main app, you can just write it in plain HTML. That's what I do, albeit for much simpler "App is loading" things.


And then you would also rewrite the simple modal into vanilla js?


And if you want to deliver your CLJS bundle right with that page (or the main module, if you use module splitting), then goog also has a decent amount of dialog-related functionality.


dat Rum though…

😄 1

Recently, I test the old way approch (to build an app) but with some modern libs. I use ornament and rum to style components and render them to the server (CSS in clj). I use htmx and when I need more interactivity, I use rum with SSR. I agree with @U4P4NREBY. rum is very cool to use.

💪 2
Chris McCormick23:04:36

@U024A5W9WBG you could use a simple #nbb script to render the landing page on the server side at build time. Here's an example from @U04V15CAJ:

👍 2
😎 1

I have a very low tech way of achieving the goal: I just open my page in development, find the "app" <div>, copy outer HTML, and paste it into my index.html <-- it's very quick and dirty but it allows me to whack an async on the ClojureScript load.... the HTML shows the DOM before the app loads, and you don't notice when it takes over unless I change the default page and forget to recopy it. Sorry if this is too manual, just giving an option here if there isn't a clear way to integrate it into your built tools.

👍 1
Drew Verlee04:04:39

How does a dialog help?


Thanks @U06S1EJPL, that is in fact exactly how i do it now 😄


js->clj doesn’t allow to specify a keywordise function. Normally how do you bypass this?


I guess I shall directly perform a map over the dict.


Yeah, it is impossible to pass an fn but it would be nice IMO.


If you don’t mind pulling in an extra dependency, then I think may also do the trick for you. See here 👉


Sadly for the recursive version, i.e., ->clj, keywordFN cannot be specified.

💩 1

Why do the Clojurescript JARs include precompiled class versions of data.json and tools.reader? This is causing me some nightmares in production in Datomic Cloud. I think it is the case that the compiler will use newer source files if it finds them on the classpath, but what if the source files are older, and the class files in Clojurescript are incompatible? Or worse, the dependencies are precompiled in the target environemtn and you end up with class files for the same thing on the classpath twice (which is what I think I’m hitting). In that case you get very unpredictable results depedning on classpath ORDER. Those two things are listed as dependencies already…it seems having compiled versions in the JAR is going to lead to these kinds of problems, so why deploy jars with them?


i think this was being talked about in #cljs-dev


ah, yeah, probably a better place. Thanks 🙂