Add inline-resources macro
* allows inclusion of a whole folder in the "resources/" directory
This commit is contained in:
parent
abfe467382
commit
a9fa5e4a35
1 changed files with 8 additions and 0 deletions
8
src/main/clj/dda/c4k_common/macros.clj
Normal file
8
src/main/clj/dda/c4k_common/macros.clj
Normal file
|
@ -0,0 +1,8 @@
|
|||
(ns dda.c4k-common.macros
|
||||
(:require [clojure.java.io :as io]))
|
||||
|
||||
(defmacro inline-resources [resource-path]
|
||||
(let [files (.listFiles (io/file (io/resource resource-path)))
|
||||
file-contents (map slurp files)
|
||||
file-names (map #(str resource-path "/" (.getName %)) files)]
|
||||
(zipmap file-names file-contents)))
|
Loading…
Reference in a new issue