hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
vigilancetech 2018-07-21T08:14:28.000014Z

A couple weeks ago I found a really good web page describing exactly how javelin macros expand but I neglected to book mark it, its out of my history and I can't seem to find it anymore. Does anyone know which page I might have been looking at?

vigilancetech 2018-07-21T08:15:38.000043Z

Also, I'm in a cljs repl and I try and (javelin) mx a simple defc= and it simply returns the original form, but when I do a defn it expands it. Any idea why?

2018-07-21T17:04:00.000064Z

@vigilancetech the macroexpansion seems to work for me:

user> (macroexpand  '(defc= x "hi"))
(def x (javelin.core/cell= "hi"))
user> (macroexpand  '(cell= x "hi"))
(let* [c__26127__auto__ (javelin.core/cell= x)] (set! (.-update c__26127__auto__) "hi") c__26127__auto__)

Josh Horwitz 2018-07-21T17:05:44.000045Z

I’m building a website for a non-profit I am a part of, and I was hoping of writing it in Clojure/ClojureScript. The only requirement is that it have a CMS or some other way for someone who is not very technical to update the website. Would this be a good use case for Hoplon?

2018-07-21T17:16:14.000026Z

@joshua.d.horwitz i'm biased towards the use of hoplon as much as possible, but realistically it is still a library aimed at developers. You could maybe do a light weight wrapper in hoplon for something like prismic (https://prismic.io/) that i think gives users a nice content editing platform and provides you an api to access the content.

2018-07-21T17:17:05.000083Z

i haven't tried anything like this though

2018-07-21T17:18:26.000038Z

realistically i think if you're looking for a hands off thing you can install and point users to (like wordpress) i don't think there's a great clojure/clojurescript option for that yet, reluctant as i am to admit it.

Josh Horwitz 2018-07-21T17:18:49.000042Z

No problem! Thank you, I might just write it in Hoplon

2018-07-21T17:19:05.000060Z

if you're doing complex custom development stuff that's where you really gain a ton of leverage from cljs

2018-07-21T17:19:27.000004Z

cool yeah that's probably what I would end up doing 😁

vigilancetech 2018-07-21T17:19:55.000015Z

@jjttjj here's what I get

(macroexpand  '(defc= x "hi"))
(defc= x "hi")
cljs.user>  (macroexpand  '(cell= x "hi"))
(cell= x "hi")
cljs.user>  (macroexpand  '(defn foo [x] (+ x 2)))
(def foo (cljs.core/fn ([x] (+ x 2))))
cljs.user> 

Josh Horwitz 2018-07-21T17:20:01.000065Z

Is it best just to work through the docs on the website?

Josh Horwitz 2018-07-21T17:20:20.000005Z

I’m newer to Clojure/ClojureScript

vigilancetech 2018-07-21T17:20:59.000073Z

@jjttjj ahh, I had javelin renamed as "j"

vigilancetech 2018-07-21T17:21:04.000035Z

nvm

2018-07-21T17:21:11.000047Z

cool

vigilancetech 2018-07-21T17:21:51.000077Z

this is making me think the macro not existing should probably throw an error in macroexpand

2018-07-21T17:21:56.000047Z

@joshua.d.horwitz https://github.com/hoplon/hoplon/wiki/Get-Started is probably a good place to start and there's a lot of good stuff in that wiki, though it definitely is sort of in need of some re-organization

2018-07-21T17:22:41.000011Z

https://github.com/hoplon/demos has some good demos to look at too. some are old but they mostly should still work

2018-07-21T17:23:23.000047Z

hoplon is really just a couple really simple rules and then a couple edge cases you have to eventually learn

vigilancetech 2018-07-21T17:23:49.000029Z

I'd still like to find that web page that went into detail about exactly how/why the javelin macros expand tho

2018-07-21T17:24:12.000017Z

yeah it doesn't ring a bell for me but it sounds interesting

Josh Horwitz 2018-07-21T17:24:52.000071Z

Thanks, I’ll start working through it

2018-07-21T17:25:15.000068Z

basically you just got html elems as functions ie (div ... <args>)

2018-07-21T17:26:12.000062Z

can be any combination, in any order, either :key "value" pairs {:key "value"} maps, which are all merged in the end and used as the element's attributes

2018-07-21T17:26:25.000032Z

everything else is interpreted as a child

2018-07-21T17:26:47.000005Z

which can basically be a regular value, a cell, or another elemnet