For those of you playing along at home, you may have noticed that there 
were two bugs in the code I presented above. I have since fixed those 
issues in the Gitlab repository that I linked to in my previous post. If 
you didn't just grab the repository, here are the fixes for you to add 
manually to your setups:

Fix 1: Corrected deps.edn

{:paths ["src/clj" "src/cljs" "resources"]

 :deps {org.clojure/clojure       {:mvn/version "1.9.0"}
        org.clojure/clojurescript {:mvn/version "1.10.312"}
        ring                      {:mvn/version "1.7.0-RC1"}
        ring/ring-defaults        {:mvn/version "0.3.2"}
        prone                     {:mvn/version "1.6.0"}
        compojure                 {:mvn/version "1.6.1"}
        hiccup                    {:mvn/version "1.0.5"}
        reagent                   {:mvn/version "0.8.1"}}

 :aliases {:run        {:main-opts ["-m" "my-project.server"]}
           :cljsbuild  {:main-opts ["-m" "cljs.main" "-co" "cljsbuild.edn" 
"-c"]}
           :figwheel   {:extra-deps {org.clojure/tools.nrepl {:mvn/version 
"0.2.13"}
                                     cider/cider-nrepl       {:mvn/version 
"0.17.0"}
                                     com.cemerick/piggieback {:mvn/version 
"0.2.2"}
                                     figwheel-sidecar        {:mvn/version 
"0.5.14"}}
                        :main-opts ["-e" 
"(use,'figwheel-sidecar.repl-api),(start-figwheel!)"]}}}

The issue was that leaving src/cljs out of the :paths vector and adding it 
with :extra-paths in the :cljsbuild alias had left the :figwheel alias 
unable to load CLJS files at the CLJS REPL that it spawns. The above code 
corrects this problem.

Fix 2: Corrected views.clj

(ns my-project.views
  (:require [hiccup.page :refer [html5 include-css include-js]]))

(defn render-page []
  (html5
   [:head
    [:title "My Project"]
    [:meta {:charset "utf-8"}]
    [:meta {:name "viewport" :content "width=device-width, initial-scale=1"
}]
    (include-css "/css/style.css")
    (include-js "/cljs/app.js")]
   [:body
    [:div#app]
    [:script {:type "text/javascript"} "my_project.client.mount_root();"]]))


In my initial post, I accidentally left out a closing square bracket in the 
render-page function. This block of code adds it back in.


Okay, folks. That's it for now. Once again, you can just grab the corrected 
template from this Gitlab link if you are so inclined:

  https://gitlab.com/lambdatronic/clojure-webapp-template

Over and out,
  Gary

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to