summaryrefslogtreecommitdiff
path: root/srv/src/http
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-08-16 21:46:02 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-08-16 21:46:02 -0600
commit960e33d6491a4bbfdf12794ae504a26c526cc89c (patch)
treea908b40f8fbf70d4fc16835e12c51d69f1096d4a /srv/src/http
parentbf8412969a60b5da29d622418e8a4efd9d444a12 (diff)
inline css into pages
Diffstat (limited to 'srv/src/http')
-rw-r--r--srv/src/http/tpl.go5
-rw-r--r--srv/src/http/tpl/base.html4
2 files changed, 7 insertions, 2 deletions
diff --git a/srv/src/http/tpl.go b/srv/src/http/tpl.go
index fb0f5bd..2edd7ac 100644
--- a/srv/src/http/tpl.go
+++ b/srv/src/http/tpl.go
@@ -66,6 +66,11 @@ func (a *api) tplFuncs() template.FuncMap {
path = filepath.Join("static", path)
return a.blogURL(path, false)
},
+ "StaticInlineCSS": func(path string) (template.CSS, error) {
+ path = filepath.Join("static", path)
+ b, err := staticFS.ReadFile(path)
+ return template.CSS(b), err
+ },
"AssetURL": func(id string) string {
path := filepath.Join("assets", id)
return a.blogURL(path, false)
diff --git a/srv/src/http/tpl/base.html b/srv/src/http/tpl/base.html
index 595ffe3..64b5ac3 100644
--- a/srv/src/http/tpl/base.html
+++ b/srv/src/http/tpl/base.html
@@ -2,8 +2,8 @@
<html>
<head>
- <link rel="stylesheet" href="{{ StaticURL "new.css" }}">
- <link rel="stylesheet" href="{{ StaticURL "mediocre.css" }}">
+ <style>{{ StaticInlineCSS "new.css" }}</style>
+ <style>{{ StaticInlineCSS "mediocre.css" }}</style>
</head>
<body>