Adds CSS modules to the build pipeline

This commit is contained in:
alonso.torres 2023-03-06 14:13:21 +01:00
parent 0e585cd585
commit 94a98a1866
6 changed files with 134 additions and 7 deletions

View file

@ -0,0 +1,21 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.main.style
"A fonts loading macros."
(:require
[app.common.data :as d]
[clojure.data.json :as json]))
(defmacro css
[selector]
(let [;; Get the associated styles will be module.cljs => module.css.json
filename (:file (meta *ns*))
styles-file (str "./src/" (subs filename 0 (- (count filename) 4)) "css.json")
data (-> (slurp styles-file)
(json/read-str))
result (get data (d/name selector))]
`~result))

View file

@ -448,7 +448,7 @@
(assert (even? (count params)))
(str/join " " (reduce (fn [acc [k v]]
(if (true? (boolean v))
(conj acc (name k))
(conj acc (d/name k))
acc))
[]
(partition 2 params))))