From bb4091acb58f0724dca262bc137715f6ed882e5f Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 8 Sep 2023 08:55:10 -0500 Subject: 1.0, why not --- boudin.page.style.scm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 boudin.page.style.scm (limited to 'boudin.page.style.scm') 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 @@ +(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)) -- cgit 1.4.1-21-gabe81