Skip to content

Commit ef19ff9

Browse files
authored
Merge pull request #8 from BackendStack21/feat/no-etag-cli-flag
Adding no-etag flag and fixing fonts
2 parents db73799 + 770807d commit ef19ff9

File tree

12 files changed

+131
-34
lines changed

12 files changed

+131
-34
lines changed

benchmark/baremetal.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ main() {
179179
NAMES=("static-web (preload+gc400)" "Bun")
180180

181181
# ======================================================================
182-
# Test 1: static-web --preload --gc-percent 400 (production mode)
182+
# Test 1: static-web --preload --gc-percent 400 --no-etag (production mode)
183183
# ======================================================================
184184
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
185-
echo -e "${BOLD} [ static-web — production: --preload --gc-percent 400 ]${RESET}"
185+
echo -e "${BOLD} [ static-web — production: --preload --gc-percent 400 --no-etag ]${RESET}"
186186
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
187187

188-
"$BIN" --quiet --no-compress --preload --gc-percent 400 --port "$PORT" "$abs_root" &
188+
"$BIN" --quiet --no-compress --no-etag --preload --gc-percent 400 --port "$PORT" "$abs_root" &
189189
SERVER_PID=$!
190190
sleep "$SETTLE_SECONDS"
191191
wait_for_port "$PORT"

cmd/static-web/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ func runServe(args []string) {
101101
// Compression.
102102
noCompress := fs.Bool("no-compress", false, "disable response compression")
103103

104+
// Headers.
105+
noEtag := fs.Bool("no-etag", false, "disable ETag generation and If-None-Match validation")
106+
104107
// Security.
105108
cors := fs.String("cors", "", "allowed CORS origins, comma-separated or * for all")
106109
dirListing := fs.Bool("dir-listing", false, "enable directory listing")
@@ -150,6 +153,7 @@ func runServe(args []string) {
150153
preload: *preload,
151154
gcPercent: *gcPercent,
152155
noCompress: *noCompress,
156+
noEtag: *noEtag,
153157
cors: *cors,
154158
dirListing: *dirListing,
155159
noDotfileBlock: *noDotfileBlock,
@@ -249,6 +253,7 @@ type flagOverrides struct {
249253
preload bool
250254
gcPercent int
251255
noCompress bool
256+
noEtag bool
252257
cors string
253258
dirListing bool
254259
noDotfileBlock bool
@@ -319,6 +324,11 @@ func applyFlagOverrides(cfg *config.Config, f flagOverrides) error {
319324
cfg.Compression.Enabled = false
320325
}
321326

327+
// Headers.
328+
if f.noEtag {
329+
cfg.Headers.EnableETags = false
330+
}
331+
322332
// Security.
323333
if f.cors != "" {
324334
parts := strings.Split(f.cors, ",")

docs/fonts.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* ===========================
2+
Local Fonts - Self-hosted
3+
=========================== */
4+
5+
/* Outfit - Sans-serif for all text */
6+
@font-face {
7+
font-family: 'Outfit';
8+
font-style: normal;
9+
font-weight: 400;
10+
font-display: swap;
11+
src: url('fonts/outfit-400.woff2') format('woff2');
12+
}
13+
14+
@font-face {
15+
font-family: 'Outfit';
16+
font-style: normal;
17+
font-weight: 500;
18+
font-display: swap;
19+
src: url('fonts/outfit-500.woff2') format('woff2');
20+
}
21+
22+
@font-face {
23+
font-family: 'Outfit';
24+
font-style: normal;
25+
font-weight: 600;
26+
font-display: swap;
27+
src: url('fonts/outfit-600.woff2') format('woff2');
28+
}
29+
30+
@font-face {
31+
font-family: 'Outfit';
32+
font-style: normal;
33+
font-weight: 700;
34+
font-display: swap;
35+
src: url('fonts/outfit-700.woff2') format('woff2');
36+
}
37+
38+
@font-face {
39+
font-family: 'Outfit';
40+
font-style: normal;
41+
font-weight: 800;
42+
font-display: swap;
43+
src: url('fonts/outfit-800.woff2') format('woff2');
44+
}
45+
46+
/* Fira Code - Monospace for source code and configs */
47+
@font-face {
48+
font-family: 'Fira Code';
49+
font-style: normal;
50+
font-weight: 400;
51+
font-display: swap;
52+
src: url('fonts/firacode-400.woff2') format('woff2');
53+
}
54+
55+
@font-face {
56+
font-family: 'Fira Code';
57+
font-style: normal;
58+
font-weight: 500;
59+
font-display: swap;
60+
src: url('fonts/firacode-500.woff2') format('woff2');
61+
}

docs/fonts/firacode-400.woff2

35.4 KB
Binary file not shown.

docs/fonts/firacode-500.woff2

35.4 KB
Binary file not shown.

docs/fonts/outfit-400.woff2

31.5 KB
Binary file not shown.

docs/fonts/outfit-500.woff2

31.5 KB
Binary file not shown.

docs/fonts/outfit-600.woff2

31.5 KB
Binary file not shown.

docs/fonts/outfit-700.woff2

31.5 KB
Binary file not shown.

docs/fonts/outfit-800.woff2

31.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)