-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbb.edn
More file actions
40 lines (40 loc) · 2.07 KB
/
bb.edn
File metadata and controls
40 lines (40 loc) · 2.07 KB
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
{:paths ["src" "resources"]
:deps {markdown-clj/markdown-clj {:mvn/version "1.12.3"}
io.github.escherize/huff {:mvn/version "0.2.13"}}
:pods {org.babashka/fswatcher {:version "0.0.5"}}
:tasks {build {:requires [[babashka.fs :as fs]
[clojure-camp-site.base :as base]
[clojure-camp-site.pages :as pages]]
:task
(do
(println "Building...")
(fs/create-dirs "static")
(fs/copy-tree "./resources/clojure_camp_site/assets" "static/assets" {:replace-existing true})
(doseq [[path f] pages/pages
:let [target-path (str "static/" path "/index.html")]]
(fs/create-dirs (fs/parent target-path))
(spit target-path (base/build f)))
(spit "static/CNAME" "clojure.camp"))}
serve {:extra-deps {org.babashka/http-server {:mvn/version "0.1.13"}}
:requires [[babashka.http-server :as http]]
:task (do
(run 'build)
(http/serve {:port 7777 :dir "static"})
(deref (promise)))}
watch {:requires [[pod.babashka.fswatcher :as fw]
[babashka.fs :as fs]]
:task (do
(println "Watching...")
(doseq [dir ["src" "resources"]]
(fw/watch dir
(fn [event]
(println "Reloading...")
;; reload all files
(->> (fs/glob "src" "**.clj")
(map (fn [f]
(load-file (.toString f))))
doall)
(run 'build))
{:recursive true
:delay-ms 250}))
(run 'serve))}}}