Fork me on GitHub
#clojurescript
<
2023-02-17
>
Empyreans15:02:54

Hello, I'm new to frontend but have strong backend skills. I want to build a simple blog-like website and I also want to optimize for large images, design experimentation with css, and real time animation (canvas, p5, three.js). Now from my research, frontend tooling makes my head spin. Is there a way to avoid and simplify the process while still achieving my goals? I do not want to build a complex single page application. Just a flexible personal website that does not overuse tooling/libs, I'd rather concentrate on the basics while still being able to iterate quickly and present professionally. I fell in love with Clojure/Script and am wondering if these two are sensible given my goals, how the tooling feels here, and generally, on what parts of js/css/html tooling I need to fous, what current state of the art is, helpful resources, how you would approach this... so a little bit open ended 🙂 Please share your thoughts.

kennytilton15:02:00

Do you care if React is involved? Or are you happy as long as you can do HTML and use libs like three.js?

Empyreans15:02:01

If there is a value to be had from using React in this setting, I would not reject it. I just thought this is a tool to be used for SPAs.

kennytilton15:02:44

Actually, my concern is that React can be a headspinner. But most CLJS libs sit atop it. What did you think of Reagent, if your research covered that? https://github.com/reagent-project/reagent/blob/master/README.md I did this with Reagent and it seemed approachable, but my tolerance for UI pain is pretty high after forty years. https://github.com/kennytilton/hiringagent/blob/main/README.md

kennytilton17:02:57

Also, if this un-framework approach https://tilton.medium.com/simplejx-aweb-un-framework-e9b59c12dcff is what you have in mind, @U04JD5WSD9P, and if you do not mind being one of the first ten users, I am about to ship a CLJS version: https://github.com/kennytilton/web-mx/blob/main/doc/intro-counter.md. I will be happy to "onboard" you, and esp. happy to help get P5 or three.js wrapped. I have wrapped charting libraries in my old Common Lisp UIs, but it would be nice to have a substantial example of wrapping external JS libraries in the Web/MX samples. btw, have you looked at #clojuredart , the Flutter wrapper? It's not clear to me if your frontend inexperience will be a hindrance or a help. Flutter is a massive OO framework, but that may be OK if you are not already deep into HTML. I have that wrapped, too: https://github.com/kennytilton/flutter-mx

Sam Ritchie19:02:59

Or try out Clerk! #C035GRLJEP8

🙌 2
Sam Ritchie19:02:56

For example, lots of good reagent stuff woven in with text. http://MathBox.Mentat.org wraps a declarative library over threejs too…

👍 2
Rupert (All Street)10:02:11

If you are thinking of building someting like a blog or simple web application then you should probably build a server side rendered application with libraries like https://github.com/weavejester/hiccup, https://github.com/ring-clojure/ring and https://github.com/weavejester/compojure. Server side rendered apps have just as good performance as client side rendered apps, have better SEO and are simpler to build (only one codebase, fewer/smaller libraries to work with and no API to build). You may not need any ClojureScript at all, just Clojure. If you do need greater interactivity down the line you can sprinkle some https://github.com/bigskysoftware/htmx and/or https://github.com/hyperhype/hyperscript into your hiccup (no clojure libraries required).

👍 2
lilactown16:02:42

is there an easy way to get the source that defined another var during macroexpansion?

jpmonettas18:02:07

you can call cljs.repl/source-fn providing a env (you can obtain with &env in macros) and the symbol of the var

dnolen17:02:46

@lilactown hrm, maybe look at the REPL stuff for looking up source?

zhuxun221:02:12

For things that are covered by both Google Closure Library and the vanilla JS, which one should one prefer? Is it situational? For example, goog.date.Date vs Date. Is there any reason to prefer the Closure Library in any situations?

athomasoriginal00:02:04

It depends on the tool. GCL is pretty good at telling you when to use the JS web API over its own tools. So, in these cases just look out for the comments. For everything else, it's best to read over the source ( when you're in question) to determine what to use. For example, if we were determining whether to use goog.data.Date or Date we would see that goog's version is using Date under the hood and is itself providing some conveniences. So, you would have to determine if you want those conveniences. If you don't, opt for Date.

athomasoriginal00:02:16

Aside from implementation details, if you lean on GCL in other parts of your app, you may want to opt to continue using GCL for consistency or because GCL functions tend to work nicely with each other.

athomasoriginal00:02:25

Final note: experiment with things. You, generally speaking, can't go wrong with using GCL, so write your code with GCL and then write it with the JS web API. You will start to develop an opinion on how/when to use.