Add inline-resources macro

* allows inclusion of a whole folder in the "resources/" directory
This commit is contained in:
bom 2023-10-27 16:29:43 +02:00
parent abfe467382
commit a9fa5e4a35

View 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)))