Repository navigation
Commit 62d84a8
committed
AVIF for the two pictures every visitor fetches
The banner on the home page is that page's largest contentful paint --
literally the thing Google times the page by -- and at 1280 wide it was
99.5 KB. The logo lockup is in the header of every page. Both now have
an AVIF beside them, offered first through <picture>; a browser that
cannot read it skips the source and takes the WebP underneath, which is
the file it gets today.
hero 1280w 99.5 KB -> 58.0 KB 42% smaller
hero 800w 44.3 KB -> 26.0 KB 41% smaller
logo 400w 27.2 KB -> 17.4 KB 36% smaller
logo 240w 16.8 KB -> 10.1 KB 40% smaller
Smaller is easy; smaller without looking worse is the part worth
checking. Decoded against the original and compared pixel by pixel, mean
absolute error per channel, alpha composited rather than discarded:
hero 1280w 2.50 -> 2.51 the same picture, at 58% of the weight
hero 800w 3.18 -> 2.93 closer to the original than the WebP is
logo 400w 2.28 -> 1.31 closer
logo 240w 3.42 -> 1.68 closer
The logo gains most because flat colour and hard edges are what AVIF is
best at and what WebP handles worst. Its transparency survives the
encode and the dimensions match exactly, which is the thing to confirm
before believing any of the above -- an opaque AVIF would have put a
black box in the header of every page.
scripts/image-variants.mjs writes them, from the same widths the markup
asks for, and runs first in build and dev. It writes nothing when the
copies are already newer than their source, so a publish that changes no
picture produces no diff. Like fetch-content.mjs it never fails the
build: sharp is a native dependency, and a machine that cannot install
it still publishes the site from what is committed, and says so.
The WebP files are left exactly as they are. The first version of this
regenerated them too, at a lower quality, which is a generation of loss
for nothing -- the gain here is the format, not the quality dial.
<picture> wraps the img with display:contents, so it is a wrapper for
the browser's choosing rather than a box in the layout. The hero img is
absolutely positioned and an inline <picture> around it would still
generate a line box inside the band.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0128YzbhrfGdegUSc9RrARRf1 parent 39a74fe commit 62d84a8
86 files changed
Lines changed: 1038 additions & 256 deletions
File tree
- .vite
- about
- assets
- bikes
- kanyakumari
- nagercoil
- blog
- documents-to-rent-a-self-drive-car
- driving-in-kanyakumari-district
- km-limits-and-deposits-explained
- one-day-kanyakumari-by-car
- self-drive-or-with-a-driver
- car-rental
- azhagiapandipuram
- boothapandi
- colachel
- eraniel
- kanyakumari
- kuzhithurai
- marthandam
- nagercoil
- padmanabhapuram
- suchindram
- thiruvattar
- thuckalay
- cars
- glanza-automatic
- grand-i10
- innova
- rumion
- swift
- wagonr
- contact
- monthly
- nagercoil
- my-app
- public
- scripts
- src/components
- nri
- places
- services
- tariff
- tourist-vehicles
- kanyakumari
- wedding-cars
- kanyakumari
- nagercoil
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
| 28 | + | |
25 | 29 | | |
| 30 | + | |
26 | 31 | | |
| 32 | + | |
27 | 33 | | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
0 commit comments