diff --git a/Makefile b/Makefile
index 9dbd76e..824afa2 100644
--- a/Makefile
+++ b/Makefile
@@ -22,24 +22,26 @@ SRCPAGES := $(shell find $(SRCDIR)/pages/* -name '*.scm')
SRCSTYLES := $(shell find $(SRCDIR)/styles/* -name '*.scm')
SRCJS := $(shell find $(SRCDIR)/scripts/* -name '*.js')
+BUILDTIME=$(shell date "+%s")
+
all: $(OUTDIR) $(STATICDIR) pages styles js
pages: $(SRCPAGES)
for page in $(SRCPAGES) ; do \
- $(SCHEME) $(SCHEMEFLAGS) $$page \
+ $(SCHEME) $(SCHEMEFLAGS) -e "(define build-time $(BUILDTIME))" -s $$page \
| sed -f scripts/minify-html.sed \
> $$(echo $$page | sed 's/.*\/pages/dist/' | sed 's/scm/xhtml/') \
; done
styles: $(SRCSTYLES)
for style in $(SRCSTYLES) ; do \
- $(SCHEME) $(SCHEMEFLAGS) $$style \
- > $$(echo $$style | sed 's/.*\/styles/dist/' | sed 's/scm/css/') \
+ $(SCHEME) $(SCHEMEFLAGS) -e "(define build-time $(BUILDTIME))" -s $$style \
+ > $$(echo $$style | sed 's/.*\/styles/dist/' | sed 's/scm/$(BUILDTIME).css/') \
; done
js: $(SRCJS)
for script in $(SRCJS) ; do \
- cp $$script $$(echo $$script | sed 's/.*\/scripts/dist/') \
+ cp $$script $$(echo $$script | sed 's/.*\/scripts/dist/' | sed 's/js/$(BUILDTIME).js/') \
; done
$(OUTDIR):
diff --git a/config.mk b/config.mk
index 4294469..54bc47a 100644
--- a/config.mk
+++ b/config.mk
@@ -16,7 +16,7 @@
# along with this program. If not, see .
SCHEME=csi
-SCHEMEFLAGS=-s
+SCHEMEFLAGS=
SRCDIR=src
STATICDIR=public
diff --git a/src/templates/clean.scm b/src/templates/clean.scm
index 2590363..2f13c41 100644
--- a/src/templates/clean.scm
+++ b/src/templates/clean.scm
@@ -16,6 +16,13 @@
;; along with this program. If not, see .
(import scss)
+(import (chicken string))
+
+(define (path-with-build-time path suffix)
+ (string-translate* path
+ `((,suffix . ,(string-intersperse
+ `("." ,(number->string build-time) ,suffix)
+ "")))))
(define (clean-tpl
page-title
@@ -40,7 +47,8 @@
`(meta ,(append '(@) args))) page-meta)
,(map (lambda (l)
- `(link (@ (rel "stylesheet") (href ,l))))
+ `(link (@ (rel "stylesheet")
+ (href ,(path-with-build-time l ".css")))))
page-styles)
(title ,page-title)
@@ -51,4 +59,9 @@
(body
,page-content
- ,(map (lambda (l) `(script (@ (src ,l) (type "text/javascript")) " ")) page-scripts))))
+ ,(map
+ (lambda (l)
+ `(script (@ (src ,(path-with-build-time l ".js"))
+ (type "text/javascript"))
+ " "))
+ page-scripts))))