Commit 8171819d authored by Cheshire Yang's avatar Cheshire Yang
Browse files

Add functions for including CSS files (basic, WIP)

parent 8980a330
......@@ -14,7 +14,7 @@
;; Location and list of styles
;; *STYLES* should be list of strings representing relative filenames.
;; @TO-DO: replace this with better css preprocessing.
(defparameter *STYLES-DIR* (asdf:system-relative-pathname :cl-site "content/css/"))
(defparameter *STYLES-DIR* (asdf:system-relative-pathname :cl-site "layout/css/"))
(defparameter *STYLES*
(list "main.css"))
......@@ -2,8 +2,8 @@
(in-package :cl-site)
; Makes pathname from prefix + page object
(defun make-path (prefix page)
(let ((path (cdr (assoc :content page))))
(defun make-path (prefix suffix &optional page)
(let ((path (if page (cdr (assoc :content suffix)) suffix)))
(if (pathnamep prefix)
(merge-pathnames path prefix)
(pathname (concatenate 'string
html, body {
margin: 0;
padding: 0;
height: 100%;
* { box-sizing: border-box; }
.header, .main {
width: 70%;
margin-left: auto;
margin-right: auto;
.header {
\ No newline at end of file
......@@ -2,12 +2,27 @@
<link href="{{location}}" rel="stylesheet" type="text/css">
<header>Site Title</header>
<header class="header">
<main class="main">
<aside class="sidebar">
<section class="content">
......@@ -2,4 +2,6 @@
(in-package :cl-site)
(defun make-site ()
\ No newline at end of file
\ No newline at end of file
......@@ -2,7 +2,15 @@
(in-package :cl-site)
;; Copies/renders stylesheets + adds to global context
(defun process-styles () )
(defun process-styles ()
((styles-list (mapcar
(lambda (s) (progn
(uiop:copy-file (make-path *STYLES-DIR* s)
(make-path *OUTPUT-DIR* s))
(cons :location s)))
(push (cons :styles styles-list) *GLOBAL-CONTEXT*)))
;; Copies/renders static assets (imgs, etc)
(defun process-static () )
......@@ -11,15 +19,16 @@
;; process-pages : Copies/renders pages - called last
(defun render-page (page template-path)
((page-path (make-path *PAGES-DIR* page))
(output-path (make-path *OUTPUT-DIR* page))
((page-path (make-path *PAGES-DIR* page t))
(output-path (make-path *OUTPUT-DIR* page t))
(page-content (file-to-string page-path))
(page-context (remove-if (lambda (p) (find p *PRIVATE-KEYS*))
(push (cons :page-content page-content) page) :key 'car)))
(with-open-file (output-stream output-path :direction :output
:if-exists :supersede)
(mustache:render template-path page-context output-stream))))
(mustache:render template-path (append page-context *GLOBAL-CONTEXT*)
(defun process-pages ()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment