diff options
| author | unwox <me@unwox.com> | 2024-10-22 22:12:38 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-10-22 22:12:38 +0600 |
| commit | 2fb30f2f4c044f101d5b7b03eb50a05d716d98f1 (patch) | |
| tree | 70ffc3a3de0c2f61fd5f4aea17efc1f9651960ed | |
| parent | b98f5858af010ea4c0f6a757410cd1c8ec72fa25 (diff) | |
inline style.css into html
| -rw-r--r-- | bin/serve.fnl | 4 | ||||
| -rw-r--r-- | lib/fs.fnl | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl index 51f5d6b..d96056a 100644 --- a/bin/serve.fnl +++ b/bin/serve.fnl @@ -10,6 +10,7 @@ (local array (require :lib.array)) (local str (require :lib.string)) (local texts (require :texts)) +(local fs (require :lib.fs)) (local spellfix (require :lib.spellfix)) (local cache (require :lib.cache)) (local {: must : measure} (require :lib.utils)) @@ -355,7 +356,8 @@ [:head {} [:meta {:charset "utf-8"}] [:meta {:name "viewport" :content "width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=5.0"}] - [:link {:rel "stylesheet" :href "/static/style.css"}] + ;; inline styles so the page loads faster + [:style {} [:NO-ESCAPE (fs.read-file "static/style.css")]] [:link {:rel "icon" :href "/static/favicon.png"}] [:link {:rel "preload" :href "/static/logo-hor.svg"}] [:title {} (if (str.empty? form.query) diff --git a/lib/fs.fnl b/lib/fs.fnl new file mode 100644 index 0000000..e56eb8f --- /dev/null +++ b/lib/fs.fnl @@ -0,0 +1,5 @@ +(fn read-file [file] + (with-open [f (io.open file "r")] + (f:read :*all))) + +{: read-file} |
