inline css into pages
This commit is contained in:
parent
bf8412969a
commit
960e33d649
@ -66,6 +66,11 @@ func (a *api) tplFuncs() template.FuncMap {
|
|||||||
path = filepath.Join("static", path)
|
path = filepath.Join("static", path)
|
||||||
return a.blogURL(path, false)
|
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 {
|
"AssetURL": func(id string) string {
|
||||||
path := filepath.Join("assets", id)
|
path := filepath.Join("assets", id)
|
||||||
return a.blogURL(path, false)
|
return a.blogURL(path, false)
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="{{ StaticURL "new.css" }}">
|
<style>{{ StaticInlineCSS "new.css" }}</style>
|
||||||
<link rel="stylesheet" href="{{ StaticURL "mediocre.css" }}">
|
<style>{{ StaticInlineCSS "mediocre.css" }}</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user