Browse Source

serve the fonts in woff2 and only preload the ones used on every page

- convert Source Serif Pro and Source Sans Pro to woff2 (lossless,
  ~500 KB -> ~155 KB) and only declare the woff2 format, which is
  supported by all current browsers
- only preload the body and menu fonts: JetBrains Mono is only used by
  code blocks. Previously, five fonts were preloaded (~800 KB), including
  JetBrains Mono in three formats.
- remove the unused material-icons fonts (icons are inline SVG)

Refs #11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNHsWYTXPThURz6TbVS1j3
master
Nicolas Massé 1 month ago
parent
commit
35c8084b76
  1. 8
      assets/css/itix.css
  2. 10
      layouts/_partials/head.html
  3. BIN
      static/fonts/JetBrainsMono-Regular.ttf
  4. BIN
      static/fonts/JetBrainsMono-Regular.woff
  5. BIN
      static/fonts/SourceSansPro-Regular.ttf
  6. BIN
      static/fonts/SourceSansPro-Regular.woff2
  7. BIN
      static/fonts/SourceSerifPro-Regular.ttf
  8. BIN
      static/fonts/SourceSerifPro-Regular.woff2
  9. BIN
      static/fonts/material-icons.ttf
  10. BIN
      static/fonts/material-icons.woff2

8
assets/css/itix.css

@ -41,9 +41,7 @@
*/ */
@font-face{ @font-face{
font-family: 'JetBrains Mono'; font-family: 'JetBrains Mono';
src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2'), src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2');
url('/fonts/JetBrainsMono-Regular.woff') format('woff'),
url('/fonts/JetBrainsMono-Regular.ttf') format('truetype');
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
@ -57,7 +55,7 @@
@font-face{ @font-face{
font-family: 'Source Serif Pro'; font-family: 'Source Serif Pro';
src: url('/fonts/SourceSerifPro-Regular.ttf') format('truetype'); src: url('/fonts/SourceSerifPro-Regular.woff2') format('woff2');
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
@ -71,7 +69,7 @@
@font-face{ @font-face{
font-family: 'Source Sans Pro'; font-family: 'Source Sans Pro';
src: url('/fonts/SourceSansPro-Regular.ttf') format('truetype'); src: url('/fonts/SourceSansPro-Regular.woff2') format('woff2');
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;

10
layouts/_partials/head.html

@ -14,13 +14,11 @@
<!-- <!--
-- Core Web Vitals / Cumulative Layout Shift. -- Core Web Vitals / Cumulative Layout Shift.
-- --
-- Preload all fonts and images to reduce layout shifts. -- Preload the fonts used on every page (body text, menu and toolbar).
-- The monospace font is only used by code blocks: it is not preloaded.
--> -->
<link rel="preload" href="/fonts/JetBrainsMono-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous"> <link rel="preload" href="/fonts/SourceSerifPro-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/fonts/JetBrainsMono-Regular.woff" as="font" type="font/woff" crossorigin="anonymous"> <link rel="preload" href="/fonts/SourceSansPro-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/fonts/JetBrainsMono-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<link rel="preload" href="/fonts/SourceSerifPro-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<link rel="preload" href="/fonts/SourceSansPro-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<!-- <!--
-- Add a reference to the favicon.ico. -- Add a reference to the favicon.ico.

BIN
static/fonts/JetBrainsMono-Regular.ttf

Binary file not shown.

BIN
static/fonts/JetBrainsMono-Regular.woff

Binary file not shown.

BIN
static/fonts/SourceSansPro-Regular.ttf

Binary file not shown.

BIN
static/fonts/SourceSansPro-Regular.woff2

Binary file not shown.

BIN
static/fonts/SourceSerifPro-Regular.ttf

Binary file not shown.

BIN
static/fonts/SourceSerifPro-Regular.woff2

Binary file not shown.

BIN
static/fonts/material-icons.ttf

Binary file not shown.

BIN
static/fonts/material-icons.woff2

Binary file not shown.
Loading…
Cancel
Save