Move components
This commit is contained in:
parent
b40471bde2
commit
0f7978cc5c
6 changed files with 14 additions and 14 deletions
src/components/document
34
src/components/document/styles.lisp
Normal file
34
src/components/document/styles.lisp
Normal file
|
@ -0,0 +1,34 @@
|
|||
(defpackage #:hp/components/document/styles
|
||||
(:use #:cl)
|
||||
(:local-nicknames (#:pi #:piccolo))
|
||||
(:import-from #:hp/view/asset
|
||||
#:defasset
|
||||
#:get-css-paths)
|
||||
(:export #:on-demand-styles
|
||||
#:styles))
|
||||
(in-package #:hp/components/document/styles)
|
||||
|
||||
(defasset *ress* :vendor "ress@5.0.2.css")
|
||||
(defasset *global* :css "global.css")
|
||||
|
||||
(pi:define-element on-demand-styles ()
|
||||
(let* ((html-str (let ((pi:*escape-html* nil))
|
||||
(pi:elem-str pi:children)))
|
||||
(css-paths (get-css-paths html-str)))
|
||||
(pi:h
|
||||
(<>
|
||||
(mapcar (lambda (path)
|
||||
(link :rel "stylesheet" :type "text/css" :href path))
|
||||
css-paths)))))
|
||||
|
||||
(pi:define-element styles ()
|
||||
(pi:h
|
||||
(<>
|
||||
(link :rel "stylesheet" :type "text/css" :href *ress*)
|
||||
(link :rel "stylesheet" :type "text/css" :href *global*)
|
||||
(on-demand-styles pi:children)
|
||||
(link :rel "preconnect" :href "https://fonts.googleapis.com")
|
||||
(link :rel "preconnect" :href "https://fonts.gstatic.com" :crossorigin t)
|
||||
(link
|
||||
:rel "stylesheet"
|
||||
:href "https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap"))))
|
Loading…
Add table
Add a link
Reference in a new issue