Rename cmp to scope
This commit is contained in:
parent
b771eec3b5
commit
92c11d61a9
5 changed files with 13 additions and 13 deletions
src
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
(pi:define-element page ()
|
(pi:define-element page ()
|
||||||
(pi:h
|
(pi:h
|
||||||
(section :data-cmp "pages/about"
|
(section :data-scope "pages/about"
|
||||||
(h1 "About")
|
(h1 "About")
|
||||||
(a :href "/" :hx-boost "true"
|
(a :href "/" :hx-boost "true"
|
||||||
"top"))))
|
"top"))))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
(pi:define-element page ()
|
(pi:define-element page ()
|
||||||
(pi:h
|
(pi:h
|
||||||
(section :data-cmp "pages/index"
|
(section :data-scope "pages/index"
|
||||||
(h1 "Hello, World!")
|
(h1 "Hello, World!")
|
||||||
(a :href "/about" :hx-boost "true"
|
(a :href "/about" :hx-boost "true"
|
||||||
"About"))))
|
"About"))))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@scope ([data-cmp='pages/about']) {
|
@scope ([data-scope='pages/about']) {
|
||||||
:scope {
|
:scope {
|
||||||
height: 100svh;
|
height: 100svh;
|
||||||
background-color: thistle;
|
background-color: thistle;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@scope ([data-cmp='pages/index']) {
|
@scope ([data-scope='pages/index']) {
|
||||||
:scope {
|
:scope {
|
||||||
height: 100svh;
|
height: 100svh;
|
||||||
background-color: aliceblue;
|
background-color: aliceblue;
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
(:export #:collect-style-links))
|
(:export #:collect-style-links))
|
||||||
(in-package #:hp/view/optimizer)
|
(in-package #:hp/view/optimizer)
|
||||||
|
|
||||||
(defun detect-components (page-str)
|
(defun detect-scopes (html-str)
|
||||||
(remove-duplicates (re:all-matches-as-strings "(?<=data-cmp=\")[^\"]*(?=\")"
|
(remove-duplicates (re:all-matches-as-strings "(?<=data-scope=\")[^\"]*(?=\")"
|
||||||
page-str)
|
html-str)
|
||||||
:test #'string=))
|
:test #'string=))
|
||||||
|
|
||||||
(defun components->stylesheets (data-cmps)
|
(defun scopes->stylesheets (scopes)
|
||||||
(mapcar (lambda (cmp-name)
|
(mapcar (lambda (scope)
|
||||||
(concatenate 'string "/styles/" cmp-name ".css"))
|
(concatenate 'string "/styles/" scope ".css"))
|
||||||
data-cmps))
|
scopes))
|
||||||
|
|
||||||
(defun collect-style-links (page-str)
|
(defun collect-style-links (html-str)
|
||||||
(components->stylesheets (detect-components page-str)))
|
(scopes->stylesheets (detect-scopes html-str)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue