Fork me on GitHub
#clojurescript
<
2019-11-19
>
knubie01:11:46

what's the current state of the art for server-side clojurescript? I want to start rendering my single-page reagent/re-frame app server-side for SEO purposes. I found Macchiato, which looks good but wanted to check here first.

jrychter11:11:33

I use rum, which lets me do server-side rendering without introducing the complexity of running a JavaScript engine. I'm really happy with the results.

4
snorremd15:11:50

I had good success replicating the setup used in https://gitlab.com/StevenT/bamse It uses Node.js as a server thereby allowing you to do ClojureScript both server- and client-side. Edit: Considering that server-side routes (different from the app routes) makes up such a miniscule part of a server-side rendered app, I think Express and ClojureScript-JavaScript-interop works well enough. If you need multiple threads you can use Node.js' cluster module.

Bravi11:11:09

hi everyone. I've been playing around with Svelte.js recently and I truly believe it is the way to go forward for frontend - eliminating framework code and having these compilers, that just dump out plain old html / javascript / css. so I was wondering if there's something like this in clojurescript yet? most (if not all) frontend frameworks in clojurescript seem to be just React wrappers

thheller11:11:44

I'm in the process of writing something but it is nowhere near ready

jrychter11:11:06

Presented without comment, but with a heartfelt thanks to the ClojureScript team 😊

[org.clojure/clojurescript "1.10.520" :scope "provided"]
-rw-r--r--  1 jwr  staff  2471526 Nov 19 12:03 app.js
-rw-r--r--  1 jwr  staff   497125 Nov 19 12:03 

[org.clojure/clojurescript "1.10.597" :scope "provided"]
-rw-r--r--  1 jwr  staff  2384275 Nov 19 12:06 app.js
-rw-r--r--  1 jwr  staff   486855 Nov 19 12:06 

👍 4
parrot 4
🚀 4
👏 4
roman01la12:11:09

also seeing bundle getting -100KB in size, guess thanks to @thheller patch that removes unnecessary function wrappers

simple_smile 4
4
Ramon Rios18:11:26

Hey guys, do we have some example of how to setup a form on re-frame app, store the values and etc. I still thinking on OO programming this time so it's really hard for me create a form that stores it's values in db

Ramon Rios18:11:48

I don't know if the best approach is get the values individually or create a list with a key value

Lu19:11:27

You can have a nested map structure with the outmost key being for example :login-form and its value would be a map of inputs like :name :email and so on ... This would be very basic though because if you need to display errors and do other form stuff then the logic starts getting more complex pretty quickly ... but as a general idea, use maps because by knowing the key you can access your value in O(1) without the need of traversing the collection with filter or similar

Ramon Rios11:11:12

Got it, let me try this. Really thanks

Lu12:11:08

I wrote a very small library to handle forms for re-frame you might look at to see how I am doing it :) https://github.com/luciodale/fork

Lu19:11:44

There are use cases where sequences work great but I don’t think this is one of those

ec21:11:19

is lein new re-frame <appname> is way to go for a new reframe project? Does it have all the benefits of shadow-cljs easy npm integration, no need for cljsjs?

mikethompson23:11:17

@cakir-enes yes, that is the way to go

mikethompson23:11:49

And, yes, that template uses shadow-cljs