summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haunt/asset.scm14
-rw-r--r--haunt/builder/assets.scm5
2 files changed, 11 insertions, 8 deletions
diff --git a/haunt/asset.scm b/haunt/asset.scm
index 0255010..2d9e27b 100644
--- a/haunt/asset.scm
+++ b/haunt/asset.scm
@@ -55,9 +55,9 @@ PREFIX."
(mkdir-p (dirname target*))
(copy-file source target*)))))
-(define (directory-assets directory dest)
+(define (directory-assets directory keep? dest)
"Create a list of asset objects to be stored within DEST for all
-files in DIRECTORY, recursively."
+files in DIRECTORY that match KEEP?, recursively."
(define enter? (const #t))
;; In order to do accurate file name manipulation, every file name
@@ -67,10 +67,12 @@ files in DIRECTORY, recursively."
(let ((base-length (length (file-name-components directory)))
(dest* (file-name-components dest)))
(lambda (file-name stat memo)
- (let* ((file-name* (file-name-components file-name))
- (target (join-file-name-components
- (append dest* (drop file-name* base-length)))))
- (cons (make-asset file-name target) memo)))))
+ (if (keep? file-name)
+ (let* ((file-name* (file-name-components file-name))
+ (target (join-file-name-components
+ (append dest* (drop file-name* base-length)))))
+ (cons (make-asset file-name target) memo))
+ memo))))
(define (noop file-name stat memo) memo)
diff --git a/haunt/builder/assets.scm b/haunt/builder/assets.scm
index 1f7424b..40ba444 100644
--- a/haunt/builder/assets.scm
+++ b/haunt/builder/assets.scm
@@ -28,6 +28,7 @@
#:use-module (ice-9 ftw)
#:use-module (ice-9 match)
#:use-module (haunt asset)
+ #:use-module (haunt site)
#:export (static-directory))
(define* (static-directory directory #:optional (dest directory))
@@ -35,5 +36,5 @@
in DIRECTORY, a file names relative to a site's source directory, and
copies them into DEST, a prefix relative to a site's target output
directory. By default, DEST is DIRECTORY."
- (lambda _
- (directory-assets directory dest)))
+ (lambda (site posts)
+ (directory-assets directory (site-file-filter site) dest)))