Improve
This commit is contained in:
parent
30aea33366
commit
84bbbce9b9
1 changed files with 11 additions and 13 deletions
|
@ -20,21 +20,20 @@
|
||||||
:htmx-ext "/vendor/htmx-ext/"
|
:htmx-ext "/vendor/htmx-ext/"
|
||||||
:alpine-ext "/vendor/alpine-ext/"))
|
:alpine-ext "/vendor/alpine-ext/"))
|
||||||
|
|
||||||
(defun asset-root (group)
|
(defun asset-root (kind)
|
||||||
(getf *asset-roots* group))
|
(getf *asset-roots* kind))
|
||||||
|
|
||||||
(defun asset-path (group path)
|
(defun asset-path (kind path)
|
||||||
(concatenate 'string (asset-root group) path))
|
(concatenate 'string (asset-root kind) path))
|
||||||
|
|
||||||
(defun asset-path-under (root)
|
(defun asset-path-under (kind)
|
||||||
(lambda (ext)
|
(lambda (path)
|
||||||
(asset-path root ext)))
|
(asset-path kind path)))
|
||||||
|
|
||||||
(defmacro define-asset (name root &body files)
|
(defmacro define-asset (name kind &body files)
|
||||||
`(defparameter ,name
|
`(defparameter ,name
|
||||||
,(if (rest files)
|
(funcall ,(if (rest files) '#'identity '#'car)
|
||||||
`(mapcar (asset-path-under ,root) ',files)
|
(mapcar (asset-path-under ,kind) ',files))))
|
||||||
`(funcall (asset-path-under ,root) ,(car files)))))
|
|
||||||
|
|
||||||
(define-asset *ress* :vendor
|
(define-asset *ress* :vendor
|
||||||
"ress@5.0.2.css")
|
"ress@5.0.2.css")
|
||||||
|
@ -65,8 +64,7 @@
|
||||||
:test #'string=))
|
:test #'string=))
|
||||||
|
|
||||||
(defun get-css-paths (html-str)
|
(defun get-css-paths (html-str)
|
||||||
(mapcar (lambda (data-prop)
|
(mapcar (asset-path-under :style)
|
||||||
(asset-path :style data-prop))
|
|
||||||
(detect-data-props html-str "data-style")))
|
(detect-data-props html-str "data-style")))
|
||||||
|
|
||||||
(defun asset-props (&key style script x-data)
|
(defun asset-props (&key style script x-data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue