Introduce with-cljs-devtools-prefs macro
This commit is contained in:
parent
8ce90653dc
commit
77068d3b5d
|
@ -5,3 +5,13 @@
|
||||||
"Reads a file as a string. Slurp is wrapped in a macro so it can interact with local files before clojurescript compilation."
|
"Reads a file as a string. Slurp is wrapped in a macro so it can interact with local files before clojurescript compilation."
|
||||||
[path]
|
[path]
|
||||||
(slurp (io/resource path)))
|
(slurp (io/resource path)))
|
||||||
|
|
||||||
|
(defmacro with-cljs-devtools-prefs [prefs & body]
|
||||||
|
`(let [previous-config# (devtools.prefs/get-prefs)
|
||||||
|
prefs# ~prefs]
|
||||||
|
(try
|
||||||
|
(devtools.prefs/set-prefs! prefs#)
|
||||||
|
~@body
|
||||||
|
(finally
|
||||||
|
(assert (= (devtools.prefs/get-prefs) prefs#) "someone modified devtools.prefs behind our back!")
|
||||||
|
(devtools.prefs/set-prefs! previous-config#)))))
|
||||||
|
|
Loading…
Reference in New Issue