-
Notifications
You must be signed in to change notification settings - Fork 0
/
repl.clj
53 lines (42 loc) · 1.08 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
(ns dev.repl
(:require
[clojure.java.io :as io]
[dev.build :as 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}
[]
;; this is optional
;; if using shadow-cljs you can start a watch from here
;; same as running `shadow-cljs watch your-build` from the command line
;; (shadow/watch :your-build)
;; build css once on start
(build/css-release)
;; then setup the watcher that rebuilds everything on change
(reset! css-watch-ref
(fs-watch/start
{}
[(io/file "src" "ftlmemes" "page" "pages")]
["cljs" "cljc" "clj"]
(fn [_]
(try
(println "refresh css")
(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))
(defn watch-css [_]
(go)
(println "started watch-css")
(deref (promise)))
(comment
(go))