Skip to content
Permalink
Browse files

Add figwheel-main support.

  • Loading branch information...
dimovich committed Mar 10, 2019
1 parent 4e0550e commit 94a386913efe3eb537438aa34643254bae9b52f9
@@ -0,0 +1,3 @@
{:main todo-list.client
:output-to "target/resources/public/js/main.js"
:output-dir "target/resources/public/js/out"}
@@ -6,7 +6,7 @@
[clojure.java.io :as io]
[duct.core :as duct]
[duct.core.repl :as duct-repl]
[duct.repl.figwheel :refer [cljs-repl]]
[figwheel.main.api :as fig]
[eftest.runner :as eftest]
[integrant.core :as ig]
[integrant.repl :refer [clear halt go init prep reset]]
@@ -20,6 +20,12 @@
(defn test []
(eftest/run-tests (eftest/find-tests "test")))

(defn go-cljs []
(fig/start "dev"))

(defn cljs-repl []
(fig/cljs-repl "dev"))

(def profiles
[:duct.profile/dev :duct.profile/local])

@@ -0,0 +1,6 @@
{;;:css-dirs ["resources/public/css"]
:watch-dirs ["src"]
:ring-server-options {:port 3009}
:mode :serve
:open-url false
:log-level :error}
@@ -17,14 +17,16 @@
:middleware [lein-duct.plugin/middleware]
:profiles
{:dev [:project/dev :profiles/dev]
:repl {:prep-tasks ^:replace ["javac" "compile"]
:dependencies [[cider/piggieback "0.3.10"]]
:repl-options {:init-ns user
:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}
:repl {:prep-tasks ^:replace ["javac" "compile"]}
:uberjar {:aot :all}
:profiles/dev {}
:project/dev {:source-paths ["dev/src"]
:resource-paths ["dev/resources"]
:dependencies [[integrant/repl "0.3.1"]
[cider/piggieback "0.4.0"]
[com.bhauman/figwheel-main "0.2.0"]
[com.bhauman/rebel-readline-cljs "0.1.4"]
[eftest "0.5.4"]
[kerodon "0.9.0"]]}})
[kerodon "0.9.0"]]
:repl-options {:init-ns user
:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}})
@@ -13,4 +13,5 @@

:duct.module/logging {}
:duct.module.web/site {}
:duct.module/cljs {:main todo-list.client}}
;;:duct.module/cljs {:main todo-list.client}
}
@@ -9,5 +9,6 @@
<div id="app">
</div>
<script src="/js/main.js"></script>
<script>todo_list.client.main()</script>
</body>
</html>
@@ -1,4 +1,4 @@
(ns todo-list.client
(ns ^:figwheel-hooks todo-list.client
(:require [reagent.core :as r]
[todo-list.todo :as todo]
[todo-list.todo-list :as tdl]))
@@ -87,6 +87,12 @@
[remove-completed-btn tdl-atom]
[lister tdl-atom]]))

(r/render [page]
(-> js/document
(.getElementById "app")))

(defn ^:after-load reload []
(r/render [page]
(-> js/document
(.getElementById "app"))))


(defn ^:export main [& args]
(reload))
@@ -1,9 +1,12 @@
(ns todo-list.handler.example
(:require [compojure.core :refer :all]
[compojure.route :as route]
[clojure.java.io :as io]
[integrant.core :as ig]))

(defmethod ig/init-key :todo-list.handler/example [_ options]
(context "/example" []
(GET "/" []
(io/resource "todo_list/handler/example/example.html"))))
(context "/" []
(context "/example" []
(GET "/" []
(io/resource "todo_list/handler/example/example.html")))
(route/resources "/")))

0 comments on commit 94a3869

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.