Commit fc1ae590 authored by Erik Huelsmann's avatar Erik Huelsmann

Correct omission copying layout/static/ to output/static

While at it, also separate the 'layout-dir'
and 'template-dir' concerns.
parent 923b8878
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(in-package :cl-site)
(defparameter *LAYOUT-DIR* (asdf:system-relative-pathname :cl-site "layout/templates/")
(defparameter *LAYOUT-DIR* (asdf:system-relative-pathname :cl-site "layout/")
"Pathname for location of all layout files (including templates).")
(defparameter *templates-dir* (merge-pathnames #P"templates/" *layout-dir*)
"Pathname for location of template files.")
(defparameter *OUTPUT-DIR* (asdf:system-relative-pathname :cl-site "output/")
......
......@@ -4,7 +4,8 @@
(defun make-site (&optional output-dir)
(let ((*output-dir* (or output-dir *output-dir*)))
(format t "Generating site in ~A.~%" *output-dir*)
(process-static)
(process-static *static-dir* *output-dir*)
(process-static (merge-pathnames #P"static/" *layout-dir*) *output-dir*)
(process-pages (populate-pages))))
......
......@@ -17,17 +17,16 @@
collect line into lines))))
;; Copies/renders static assets (imgs, etc)
(defun process-static ()
(let ((destination-root (merge-pathnames #P"static/" *output-dir*))
(sources (append
(directory (merge-pathnames "**/*.*" *static-dir*))
(directory (merge-pathnames "static/**/*.*" *layout-dir*))))
(defun process-static (static-dir output-dir)
(let ((destination-root (merge-pathnames #P"static/" output-dir))
(sources (directory (merge-pathnames "**/*.*" static-dir)))
static-list)
(dolist (source sources)
(let* ((relative-path (enough-namestring source *static-dir*))
(let* ((relative-path (enough-namestring source static-dir))
(destination (merge-pathnames relative-path destination-root)))
(when (pathname-name destination) ;; ignore directories
(ensure-directories-exist destination)
;(format t "~a -> ~a~%" source destination)
(uiop:copy-file source destination)
(push (cons :location relative-path) static-list))))
(push (cons :static (nreverse static-list))
......@@ -75,7 +74,7 @@
(generate-news)
(let ((template-path (pathname (merge-pathnames *LAYOUT-DIR* *DEFAULT-PAGE-TEMPLATE*))))
(let ((template-path (pathname (merge-pathnames *templates-dir* *DEFAULT-PAGE-TEMPLATE*))))
(ensure-directories-exist *OUTPUT-DIR*)
(setq pages (populate-pages)) ;; to pick up any newly generated .html files.
(dolist (page 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