Rename stylesheets to styles

This commit is contained in:
Akira Tempaku 2024-04-22 15:00:33 +09:00
commit 431e0c8de7
2 changed files with 12 additions and 12 deletions
src/view/components/document

View file

@ -1,9 +1,9 @@
(defpackage #:hp/view/components/document/main (defpackage #:hp/view/components/document/main
(:use #:cl) (:use #:cl)
(:local-nicknames (#:pi #:piccolo)) (:local-nicknames (#:pi #:piccolo))
(:import-from #:hp/view/components/document/stylesheets (:import-from #:hp/view/components/document/styles
#:stylesheets #:styles
#:on-demand-stylesheets) #:on-demand-styles)
(:import-from #:hp/view/components/document/scripts (:import-from #:hp/view/components/document/scripts
#:scripts) #:scripts)
(:import-from #:hp/view/components/document/seo (:import-from #:hp/view/components/document/seo
@ -17,7 +17,7 @@
(html :lang "ja" (html :lang "ja"
(head (head
(meta :charset "UTF-8") (meta :charset "UTF-8")
(stylesheets pi:children) (styles pi:children)
(scripts) (scripts)
(seo metadata)) (seo metadata))
pi:children))) pi:children)))
@ -26,5 +26,5 @@
(pi:h (pi:h
(<> (<>
(head :hx-head "append" (head :hx-head "append"
(on-demand-stylesheets pi:children)) (on-demand-styles pi:children))
pi:children))) pi:children)))

View file

@ -1,12 +1,12 @@
(defpackage #:hp/view/components/document/stylesheets (defpackage #:hp/view/components/document/styles
(:use #:cl) (:use #:cl)
(:local-nicknames (#:pi #:piccolo)) (:local-nicknames (#:pi #:piccolo))
(:import-from #:hp/view/asset (:import-from #:hp/view/asset
#:define-asset #:define-asset
#:get-css-paths) #:get-css-paths)
(:export #:on-demand-stylesheets (:export #:on-demand-styles
#:stylesheets)) #:styles))
(in-package #:hp/view/components/document/stylesheets) (in-package #:hp/view/components/document/styles)
(define-asset *ress* (define-asset *ress*
:vendor "ress@5.0.2.css") :vendor "ress@5.0.2.css")
@ -14,7 +14,7 @@
(define-asset *global-css* (define-asset *global-css*
:css "global.css") :css "global.css")
(pi:define-element on-demand-stylesheets () (pi:define-element on-demand-styles ()
(let* ((pi:*escape-html* nil) (let* ((pi:*escape-html* nil)
(html-str (pi:elem-str pi:children)) (html-str (pi:elem-str pi:children))
(css-paths (get-css-paths html-str))) (css-paths (get-css-paths html-str)))
@ -24,12 +24,12 @@
(link :rel "stylesheet" :type "text/css" :href path)) (link :rel "stylesheet" :type "text/css" :href path))
css-paths))))) css-paths)))))
(pi:define-element stylesheets () (pi:define-element styles ()
(pi:h (pi:h
(<> (<>
(link :rel "stylesheet" :type "text/css" :href *ress*) (link :rel "stylesheet" :type "text/css" :href *ress*)
(link :rel "stylesheet" :type "text/css" :href *global-css*) (link :rel "stylesheet" :type "text/css" :href *global-css*)
(on-demand-stylesheets pi:children) (on-demand-styles pi:children)
(link :rel "preconnect" :href "https://fonts.googleapis.com") (link :rel "preconnect" :href "https://fonts.googleapis.com")
(link :rel "preconnect" :href "https://fonts.gstatic.com" :crossorigin t) (link :rel "preconnect" :href "https://fonts.gstatic.com" :crossorigin t)
(link (link