-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepl.clj
42 lines (33 loc) · 810 Bytes
/
repl.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(ns repl
(:require
[clojure.java.io :as io]
[build]
[shadow.cljs.devtools.api :as shadow]
[shadow.cljs.devtools.server.fs-watch :as fs-watch]))
(defonce css-watch-ref (atom nil))
(defn start
{:shadow/requires-server true}
[]
;; optional, could also do this from the UI
(shadow/watch :app)
;; build css once on start
(build/css-release)
;; the watcher that rebuilds css everything on change
(reset! css-watch-ref
(fs-watch/start
{}
[(io/file "src" "main")]
["cljs" "cljc" "clj"]
(fn [_]
(try
(build/css-release)
(catch Exception e
(prn [:css-failed e]))))))
::started)
(defn stop []
(when-some [css-watch @css-watch-ref]
(fs-watch/stop css-watch))
::stopped)
(defn go []
(stop)
(start))