-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.bb
More file actions
24 lines (22 loc) · 845 Bytes
/
tasks.bb
File metadata and controls
24 lines (22 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(ns tasks
(:require
[babashka.tasks :refer [shell]]
[babashka.fs :as fs]
[clojure.string :as str]))
(defn compile-squint
"Compiles all squint files to .js"
[{:keys []}]
(println "Compiling squint files")
(doseq [path (fs/glob "src" "**{.cljs,cljc}")]
(shell (format "node node_modules/.bin/squint compile %s --extension .js" path))))
(defn watch-cljs [{:keys []}]
(let [watch (requiring-resolve 'pod.babashka.fswatcher/watch)]
(watch "src"
(fn [{:keys [type path]}]
(when
(and (#{:write :write|chmod} type)
(or (str/ends-with? path ".cljs")
(str/ends-with? path ".cljc")))
(shell {:continue true} (format "node node_modules/.bin/squint compile %s --extension .js" path))))
{:recursive true})
@(promise)))