Embed IBM plex and use sass

This commit is contained in:
heyarne 2021-07-30 00:17:45 +02:00
commit a9321013d8
254 changed files with 1428 additions and 41 deletions

View file

@ -9,11 +9,16 @@
(setdyn :pretty-format "%.20q")
# ---
# site config
# build config
# ---
(def base-path "/")
(bagatto/set-output-dir! "site")
# ---
# helper functions
# ---
(defn struct->table [s]
(table ;(interleave (keys s) (values s))))
@ -36,8 +41,32 @@
(put post :published-at (path->date (post :path)))
post))
(defn absolute-url [path]
(string base-path path))
(defn copy-and-rename [base renamer]
(fn [_data item] (path/join base (path/basename (renamer (item :path))))))
(defn sass? [_site item]
(or (string/has-suffix? ".scss" (item :path))
(string/has-suffix? ".sass" (item :path))))
(defn compile-sass [site {:path path}]
(sh/$< "sassc" ,(string path)))
(def sass-dest (copy-and-rename "assets/"
(fn [path]
(->> path
(string/replace ".sass" ".css")
(string/replace ".scss" ".css")))))
# ---
# site config
# ---
(def data {:config {:attrs {:title "arnes.space"
:stylesheet "assets/style.css"}}
:base-path base-path
:stylesheet (absolute-url "assets/style.css")}}
:assets {:src (bagatto/* "assets/*")
:attrs bagatto/parse-base}
:posts {:src (bagatto/slurp-* "content/posts/*.md")
@ -45,8 +74,10 @@
(def site {:index {:dest "index.html"
:out views/home}
:assets {:each :assets
:dest (bagatto/path-copier "assets/")}
:style {:each :assets
:dest sass-dest
:out compile-sass
:filter sass?}
:posts {:each :posts
:dest utils/slugify-content
:out views/post}})