diff options
| author | Feuerfuchs <git@feuerfuchs.dev> | 2019-06-07 09:09:47 +0200 |
|---|---|---|
| committer | Feuerfuchs <git@feuerfuchs.dev> | 2019-06-07 09:09:47 +0200 |
| commit | 49889fe083ce8cab6e340f6fb999cc8ebe42ad69 (patch) | |
| tree | 3bf3c30732a30fe6f5c42a68ae82cc5f469c3f5b /gopherproxy.go | |
| parent | Improved template readability (diff) | |
| download | gopherproxy-49889fe083ce8cab6e340f6fb999cc8ebe42ad69.tar.gz gopherproxy-49889fe083ce8cab6e340f6fb999cc8ebe42ad69.tar.bz2 gopherproxy-49889fe083ce8cab6e340f6fb999cc8ebe42ad69.zip | |
Embed CSS in executable the same way as fonts
Diffstat (limited to 'gopherproxy.go')
| -rw-r--r-- | gopherproxy.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gopherproxy.go b/gopherproxy.go index e41af3d..b65418d 100644 --- a/gopherproxy.go +++ b/gopherproxy.go | |||
| @@ -208,14 +208,22 @@ func ListenAndServe(bind, robotsfile, uri string) error { | |||
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | styledata, err := ioutil.ReadFile(".style") | ||
| 212 | if err == nil { | ||
| 213 | styletext = string(styledata) | ||
| 214 | } | ||
| 215 | |||
| 216 | box := packr.NewBox("./assets") | 211 | box := packr.NewBox("./assets") |
| 212 | |||
| 217 | fontdataw, err := box.Find("iosevka-term-ss03-regular.woff") | 213 | fontdataw, err := box.Find("iosevka-term-ss03-regular.woff") |
| 214 | if err != nil { | ||
| 215 | fontdataw = []byte{} | ||
| 216 | } | ||
| 217 | |||
| 218 | fontdataw2, err := box.Find("iosevka-term-ss03-regular.woff2") | 218 | fontdataw2, err := box.Find("iosevka-term-ss03-regular.woff2") |
| 219 | if err != nil { | ||
| 220 | fontdataw2 = []byte{} | ||
| 221 | } | ||
| 222 | |||
| 223 | styletext, err := box.FindString("style.css") | ||
| 224 | if err != nil { | ||
| 225 | styletext = "" | ||
| 226 | } | ||
| 219 | 227 | ||
| 220 | tpldata, err := ioutil.ReadFile(".template") | 228 | tpldata, err := ioutil.ReadFile(".template") |
| 221 | if err == nil { | 229 | if err == nil { |
