diff options
author | Case Duckworth | 2023-09-08 08:55:10 -0500 |
---|---|---|
committer | Case Duckworth | 2023-09-08 08:55:10 -0500 |
commit | bb4091acb58f0724dca262bc137715f6ed882e5f (patch) | |
tree | 312fb06d53a51094fcdf6b900b4dc1fe327555bc /boudin.page.style.scm | |
parent | A newerer beginning (diff) | |
download | boudin-bb4091acb58f0724dca262bc137715f6ed882e5f.tar.gz boudin-bb4091acb58f0724dca262bc137715f6ed882e5f.zip |
1.0, why not
Diffstat (limited to 'boudin.page.style.scm')
-rw-r--r-- | boudin.page.style.scm | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/boudin.page.style.scm b/boudin.page.style.scm new file mode 100644 index 0000000..351cf1a --- /dev/null +++ b/boudin.page.style.scm | |||
@@ -0,0 +1,47 @@ | |||
1 | (declare (module (boudin page style)) | ||
2 | (export make-style | ||
3 | style | ||
4 | page-style | ||
5 | style-template | ||
6 | site-style | ||
7 | style-writer)) | ||
8 | |||
9 | (import (boudin page) | ||
10 | (boudin site) | ||
11 | (scss) | ||
12 | (html-parser) | ||
13 | (srfi 152) | ||
14 | (chicken pathname)) | ||
15 | |||
16 | (define (make-style . rules) | ||
17 | (make-page rules | ||
18 | (make-pathname (site-output) "style.css") | ||
19 | (style-template) | ||
20 | (style-writer) | ||
21 | '())) | ||
22 | |||
23 | (define (style props) | ||
24 | ;; sxml: `(el (@ ,(style '((padding 3em) (color red)))) content ...) | ||
25 | (let ((sty (scss->css `(css+ (_ ,@props))))) | ||
26 | (list 'style | ||
27 | (substring sty 4 (- (string-length sty) 2))))) | ||
28 | |||
29 | (define (page-style . rules) | ||
30 | ;; sxml: `(html (head ,(page-style '(body (margin auto))))) | ||
31 | `(style ,(scss->css `(css+ ,@rules)))) | ||
32 | |||
33 | (define style-template | ||
34 | (make-parameter | ||
35 | (lambda (pg) | ||
36 | `(css+ ,@(page-content pg))))) | ||
37 | |||
38 | (define site-style | ||
39 | (make-parameter | ||
40 | '((body (font 18px/1.4 sans-serif) | ||
41 | (max-width 70ch) | ||
42 | (padding 2ch) | ||
43 | (margin 0 auto))))) | ||
44 | |||
45 | (define style-writer | ||
46 | (make-parameter | ||
47 | write-css)) | ||