The :hoplon: ClojureScript Web Framework - http://hoplon.io/
bobcalco 2018-12-26T12:56:05.115200Z

@flyboarder So with some modifications after generation, mainly to convert index.cljs.hl to pages/index.cljs using the ns form, I got the boot hoplon template working.

bobcalco 2018-12-26T12:56:35.115700Z

I also made sure all the dependencies were latest-version.

bobcalco 2018-12-26T12:56:54.115900Z


bobcalco 2018-12-26T12:57:04.116200Z

  :dependencies '[[adzerk/boot-cljs          "2.1.5"]
                  [adzerk/boot-reload        "0.6.0"]
                  [hoplon/hoplon             "7.2.0"]
                  [org.clojure/clojure       "1.10.0"]
                  [org.clojure/clojurescript "1.10.439"]
                  [tailrecursion/boot-jetty  "0.1.3"]]
  :source-paths #{"src"}
  :asset-paths  #{"assets"})

  '[adzerk.boot-cljs         :refer [cljs]]
  '[adzerk.boot-reload       :refer [reload]]
  '[hoplon.boot-hoplon       :refer [hoplon prerender]]
  '[tailrecursion.boot-jetty :refer [serve]])

(deftask dev
  "Build testhoplon for local development."
    (serve :port 8000)))

(deftask prod
  "Build testhoplon for production deployment."
    (cljs :optimizations :advanced)
    (target :dir #{"target"})))

bobcalco 2018-12-26T12:57:37.116400Z


bobcalco 2018-12-26T12:57:46.116700Z


bobcalco 2018-12-26T12:58:15.117100Z


bobcalco 2018-12-26T12:58:51.117700Z

(ns ^{:hoplon/page "index.html"} pages.index
  (:require [hoplon.core :as h :refer [div ul li link html head title body h1 span p button text]]
            [javelin.core :as j :refer [cell cell=]]

(defn my-list [&amp; items]
   :class "my-list"
   (apply ul (map #(li (div :class "my-list-item" %)) items))))

(def clicks (cell 0))

  (title "Example page")
  (link :href "app.css" :rel "stylesheet" :type "text/css"))
  (h1 "Hello, Hoplon!")
   (span "first thing")
   (span "second thing"))
  (p (text "You've clicked ~{clicks} times, so far."))
  (button :click #(swap! clicks inc) "click me")))

bobcalco 2018-12-26T13:00:02.118600Z

Running boot dev everything compiles, I get a pleasant 'ding' sound, and when I go to localhost:8000, I see what I expect.

bobcalco 2018-12-26T13:02:17.119100Z

I can't seem to upload the screenshot without upgrading to a paid plan, but let's just say, it works. I can click the button and see how many times I clicked it.

bobcalco 2018-12-26T13:02:19.119300Z


bobcalco 2018-12-26T13:02:43.119800Z

Making any change to the source causes the page not to reload so much as duplicate itself entirely.

bobcalco 2018-12-26T13:03:55.119900Z

bobcalco 2018-12-26T13:04:15.120400Z

I changed "first thing" to "first thing first" and this is what happened

bobcalco 2018-12-26T13:04:41.120800Z

Running chrom on mac os x mojave

bobcalco 2018-12-26T13:05:26.121300Z

reloading the page, it looks ok, so this is strictly a reloading issue I suppose

bobcalco 2018-12-26T13:09:56.123300Z

What I would like to understand is what exactly is happening behind the scenes. I gather it's generating the artifacts to some temp folder somewhere, because they don't appear in the working directory anywhere. I want to understand what happens when you define multiple pages, so I'll be experimenting with that next; but in the meantime, it would be good if we got reloading working correctly.

bobcalco 2018-12-26T13:11:04.124300Z

All I see for page source in the browser is:

bobcalco 2018-12-26T13:11:11.124500Z

&lt;!DOCTYPE html&gt;
&lt;html&gt;&lt;head&gt;&lt;meta charset="utf-8"&gt;&lt;/head&gt;&lt;body&gt;&lt;script type="text/javascript" src="index.html.js"&gt;&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;

bobcalco 2018-12-26T13:13:16.126Z

So presumably if I defined pages.admin.index in pages/admin/index.cljs it would do a post-back to load that page at that relative route? Or does it collaborate with jetty to manage routes and avoid that? Anyway... at least I got something working I can experiment with.

flyboarder 2018-12-26T21:14:04.126700Z

@bob592 reloading is broken in hoplon, try the latest 7.3.0-SNAPSHOT the fix is in master already

bobcalco 2018-12-26T21:14:22.127Z


flyboarder 2018-12-26T21:15:10.127600Z

behind the scenes boot is building and running everything from temp directories that it manages

bobcalco 2018-12-26T21:17:31.128100Z

OK that's better 🙂

bobcalco 2018-12-26T21:19:48.129300Z

OK so given my new happy state with the files as above, what is the process to begin to introduce logical pages using bidi or whatever for routing?

bobcalco 2018-12-26T21:22:09.129800Z

I want to start introducing state from the back end next - but first basic navigation

flyboarder 2018-12-26T21:27:14.132700Z

right so since hoplon is for single page apps, the best way to manage “pages” is to make them load on-demand, so we use template macros for that