Browse Source

Webp info

master
Chris Smith 5 years ago
parent
commit
bd22eff883
1 changed files with 29 additions and 0 deletions
  1. 29
    0
      content/docs/programming/web.adoc

+ 29
- 0
content/docs/programming/web.adoc View File

@@ -1,6 +1,8 @@
1 1
 +++
2 2
 +++
3 3
 
4
+:source-highlighter: pygments
5
+
4 6
 == Web development
5 7
 
6 8
 === Quick reference
@@ -8,6 +10,33 @@
8 10
 Text area resizing::
9 11
 `resize: vertical`, `resize: horizontal`, `resize: none`
10 12
 
13
+=== Webp support
14
+
15
+To convert images to WebP:
16
+
17
+[source,console]
18
+----
19
+$ cwebp -m 6 -mt -o "$file.webp" -- "$file"
20
+----
21
+
22
+To make nginx serve `.webp` files if the relevant accept header is sent:
23
+
24
+[source,nginx]
25
+----
26
+http {
27
+    map $http_accept $webp_suffix {
28
+        "~*webp"  ".webp";
29
+    }
30
+
31
+    server {
32
+        location ~ \.(png|jpe?g)$ {
33
+            try_files $uri$webp_suffix $uri =404;
34
+            expires 1y;
35
+        }
36
+    }
37
+}
38
+----
39
+
11 40
 === Useful links
12 41
 
13 42
 - https://simpleicons.org/ - SVG icons for brands, including social media sites and programming languages

Loading…
Cancel
Save