blob: 351cf1a886da2224a2bf5d3882fb94d0148e3e32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
(declare (module (boudin page style))
(export make-style
style
page-style
style-template
site-style
style-writer))
(import (boudin page)
(boudin site)
(scss)
(html-parser)
(srfi 152)
(chicken pathname))
(define (make-style . rules)
(make-page rules
(make-pathname (site-output) "style.css")
(style-template)
(style-writer)
'()))
(define (style props)
;; sxml: `(el (@ ,(style '((padding 3em) (color red)))) content ...)
(let ((sty (scss->css `(css+ (_ ,@props)))))
(list 'style
(substring sty 4 (- (string-length sty) 2)))))
(define (page-style . rules)
;; sxml: `(html (head ,(page-style '(body (margin auto)))))
`(style ,(scss->css `(css+ ,@rules))))
(define style-template
(make-parameter
(lambda (pg)
`(css+ ,@(page-content pg)))))
(define site-style
(make-parameter
'((body (font 18px/1.4 sans-serif)
(max-width 70ch)
(padding 2ch)
(margin 0 auto)))))
(define style-writer
(make-parameter
write-css))
|