Fix font loading (with flash of unstyled content)
This commit is contained in:
parent
a9321013d8
commit
a48f9c282d
3 changed files with 88 additions and 13 deletions
13
index.janet
13
index.janet
|
|
@ -44,6 +44,11 @@
|
|||
(defn absolute-url [path]
|
||||
(string base-path path))
|
||||
|
||||
(defn files-in [base]
|
||||
(fn []
|
||||
(let [files (string/split "\n" (sh/$< find ,base -type f))]
|
||||
{:each (filter |(not= "" $0) files)})))
|
||||
|
||||
(defn copy-and-rename [base renamer]
|
||||
(fn [_data item] (path/join base (path/basename (renamer (item :path))))))
|
||||
|
||||
|
|
@ -52,7 +57,7 @@
|
|||
(string/has-suffix? ".sass" (item :path))))
|
||||
|
||||
(defn compile-sass [site {:path path}]
|
||||
(sh/$< "sassc" ,(string path)))
|
||||
(sh/$< sassc ,path))
|
||||
|
||||
(def sass-dest (copy-and-rename "assets/"
|
||||
(fn [path]
|
||||
|
|
@ -69,6 +74,8 @@
|
|||
:stylesheet (absolute-url "assets/style.css")}}
|
||||
:assets {:src (bagatto/* "assets/*")
|
||||
:attrs bagatto/parse-base}
|
||||
:font {:src (files-in "assets/ibm-plex")
|
||||
:attrs bagatto/parse-base}
|
||||
:posts {:src (bagatto/slurp-* "content/posts/*.md")
|
||||
:attrs parse-post}})
|
||||
|
||||
|
|
@ -78,6 +85,10 @@
|
|||
:dest sass-dest
|
||||
:out compile-sass
|
||||
:filter sass?}
|
||||
:font {:each :font
|
||||
:dest (fn [_data item]
|
||||
(printf "%j" item)
|
||||
(item :path))}
|
||||
:posts {:each :posts
|
||||
:dest utils/slugify-content
|
||||
:out views/post}})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue