diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | assets/style.css | 1 | ||||
-rw-r--r-- | gopherproxy.go | 18 | ||||
-rw-r--r-- | style.go | 3 |
4 files changed, 15 insertions, 10 deletions
@@ -6,8 +6,7 @@ dev: build | |||
6 | ./gopherproxy -bind 127.0.0.1:8000 | 6 | ./gopherproxy -bind 127.0.0.1:8000 |
7 | 7 | ||
8 | build: clean | 8 | build: clean |
9 | sassc -t compressed css/main.scss style.go | 9 | sassc -t compressed css/main.scss assets/style.css |
10 | sed -i "s/.*/package gopherproxy\n\nvar styletext = \`&\`/" style.go | ||
11 | pyftsubset fonts/iosevka-term-ss03-regular.ttf --name-IDs+=0,4,6 --text-file=glyphs.txt --flavor='woff' --output-file='assets/iosevka-term-ss03-regular.woff' | 10 | pyftsubset fonts/iosevka-term-ss03-regular.ttf --name-IDs+=0,4,6 --text-file=glyphs.txt --flavor='woff' --output-file='assets/iosevka-term-ss03-regular.woff' |
12 | pyftsubset fonts/iosevka-term-ss03-regular.ttf --name-IDs+=0,4,6 --text-file=glyphs.txt --flavor='woff2' --output-file='assets/iosevka-term-ss03-regular.woff2' | 11 | pyftsubset fonts/iosevka-term-ss03-regular.ttf --name-IDs+=0,4,6 --text-file=glyphs.txt --flavor='woff2' --output-file='assets/iosevka-term-ss03-regular.woff2' |
13 | go build -o ./gopherproxy ./cmd/gopherproxy/main.go | 12 | go build -o ./gopherproxy ./cmd/gopherproxy/main.go |
diff --git a/assets/style.css b/assets/style.css new file mode 100644 index 0000000..938e25e --- /dev/null +++ b/assets/style.css | |||
@@ -0,0 +1 @@ | |||
@font-face{font-family:'Iosevka Term SS03';font-style:normal;font-weight:normal;src:url("/iosevka-term-ss03-regular.woff2") format("woff2"),url("/iosevka-term-ss03-regular.woff") format("woff")}body{margin:0;padding:0;background-color:#14171a;color:#cad1d8}.wrap{text-align:center}.content{display:inline-block;min-width:50em;min-width:85ch;margin:0;padding:2em 1em;text-align:left;font-family:'Iosevka Term SS03', 'IBM Plex Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Droid Sans Mono', Monaco, Consolas, Courier, monospace;font-size:1em;line-height:1.5}::selection{color:#000;background-color:rgba(239,198,138,0.996)}:link{color:#fff}:visited{color:#cad1d8}.link-type{color:#929ba3} | |||
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 { |
diff --git a/style.go b/style.go deleted file mode 100644 index 7e1bdb9..0000000 --- a/style.go +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | package gopherproxy | ||
2 | |||
3 | var styletext = `@font-face{font-family:'Iosevka Term SS03';font-style:normal;font-weight:normal;src:url("/iosevka-term-ss03-regular.woff2") format("woff2"),url("/iosevka-term-ss03-regular.woff") format("woff")}body{margin:0;padding:0;background-color:#14171a;color:#cad1d8}.wrap{text-align:center}.content{display:inline-block;min-width:50em;min-width:85ch;margin:0;padding:2em 1em;text-align:left;font-family:'Iosevka Term SS03', 'IBM Plex Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Droid Sans Mono', Monaco, Consolas, Courier, monospace;font-size:1em;line-height:1.5}::selection{color:#000;background-color:rgba(239,198,138,0.996)}:link{color:#fff}:visited{color:#cad1d8}.link-type{color:#929ba3}` | ||