aboutsummaryrefslogtreecommitdiff
path: root/build/improving-tufte-jekyll/index.html
blob: 84b89be1e66f4ef1094fb61ce3d88a291e2a4110 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!doctype html>
<html lang="en" id="top">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="data:,">
	<title>Improving Tufte CSS for Jekyll</title>
	<link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
	<style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style>
</head>

<nav>
  <a href="#menu">Menu &darr;</a>
</nav>

<main>
<h1>Improving Tufte CSS for Jekyll</h1>
<p>2019-11-01</p>
<p>After creating the ET-Jekyll theme almost two years ago, I finally got around to revamping the structure and improving a lot of minor performance issues. Items that have been surely needing of updates for the last couple of years.</p>
<h2>Introductions</h2>
<p>I've always been a sucker for Edward Tufte's incredibly simple, yet powerful design work used in his books and handout projects. So, in 2018 I released a Tufte CSS inspired Jekyll theme for the open source community. I called it <a href="https://et-jekyll.netlify.com">ET-Jekyll</a> (so original, I know). Tufte CSS was a great starting point for my Jekyll theme, but there were areas I thought could use some minor improvements.</p>
<p>Feel free to read all the details on the design here: <a href="https://et-jekyll.netlify.com/et-jekyll-theme/">ET-Jekyll theme details</a></p>
<h2>Minor Fixes One Year Later</h2>
<p>When I finally circled back to this project recently, I noticed some minor issues that could be improved right away with little to no effort. Let's see the changes made at a glance:</p>
<ul>
<li>Sidenote, marginnote and figure element restyling (flexbox)</li>
<li>Table styling fixes (right alignment issues)</li>
<li>Switch MathJax over to SVG embeds (performance fixes)</li>
<li>Simplify HTML skeleton of main pages, remove overkill classes</li>
<li>Remove lazysizes.js to save on load times</li>
<li>Fallback on font-display for font loading</li>
<li>Inline all CSS for faster initial paint</li>
<li>Minor link :hover coloring (accessibility)</li>
<li>Add missing image link on example page</li>
<li>Update details post structure</li>
</ul>
<p>You can view all the updates in more detail <a href="https://github.com/bradleytaunt/ET-Jekyll/commit/254f9e8f28764c9525ba7405bbbfa18a3867d241">here</a>.</p>
<p><strong>So what did this accomplish?</strong> Let's break it down below.</p>
<h2>First Contentful Paint &amp; Input Delay</h2>
<p>The new improvements have netted the theme a savings of 300ms on first paint and reduced the input delay by 150ms. Small wins - but wins nonetheless since every millisecond counts.</p>
<p><figure>
    <img src="/public/images/tufte-first-paint.webp" alt="First paint comparison" />
    <figcaption>First contentful paint savings: 300ms (<a href="/public/images/tufte-first-paint.webp">direct link to image)</a></figcaption>
</figure></p>
<p><figure>
    <img src="/public/images/tufte-input-delay.webp" alt="Input delay comparison" />
    <figcaption>Reduction in input delay: 370ms down to 220ms (<a href="/public/images/tufte-input-delay.webp">direct link to image</a>)</figcaption>
</figure></p>
<h2>Fixing Render Blocking Items</h2>
<p>The original theme reported a few items that were slowing down the initial render for the end-users:</p>
<table>
<tr><th>URL </th><th>Size (KB) </th><th>Savings (ms) </th></tr>
<tr><td>/css/style.css </td><td>2.0 </td><td>150 </td></tr>
<tr><td>/lazysizes@4.0.1/lazysizes.js </td><td>5.0 </td><td>960 </td></tr>
<tr><td>MathJax.js?config=TeX-MML-AM<em></em>HTML </td><td>18.0 </td><td>1,260 </td></tr>
</table><p>These items were resolved by:</p>
<ul>
<li>Rendering all styling inline (therefore removing the extra HTTP request)</li>
<li>Removing the lazysizes library altogether (browsers plan to support lazy loading natively in the future)
<ul>
<li>The future plan is to integrate something like Cloudinary for out-of-the-box image processing</li>
</ul>
</li>
<li>Switch over MathJax to render equations as embedded SVGs (saves on bandwidth rendering an entire extra typeface)</li>
</ul>
<h2>Lighthouse Numbers</h2>
<p>Though it might not look like much, the updated theme receives a 4-point boost to its performance rating during a Lighthouse audit. Having a perfect score would be even better, but I can settle for 2-points under (for now).</p>
<h4>Old Version</h4>
<table>
<tr><th>Performance </th><th>Accessibility </th><th>Best Practices </th><th>SEO </th></tr>
<tr><td>94 </td><td>100 </td><td>100 </td><td>100 </td></tr>
</table><h4>New Version</h4>
<table>
<tr><th>Performance </th><th>Accessibility </th><th>Best Practices </th><th>SEO </th></tr>
<tr><td>98 </td><td>100 </td><td>100 </td><td>100 </td></tr>
</table><h2>Final Thoughts</h2>
<p>This project could still use some more fine-tuning, but for now I'm fairly happy with the outcome. Even the smallest boost in performance and rendering time makes me feel like I accomplished something worthwhile. </p>
<p>Please don't hesitate to suggest features or point out any issues you happen to stumble across if you plan to use ET-Jekyll. Thanks for reading!</p>
<footer role="contentinfo">
    <h2>Menu Navigation</h2>
    <ul id="menu">
        <li><a href="/">Home</a></li>
        <li><a href="/projects">Projects</a></li>
        <li><a href="/uses">Uses</a></li>
        <li><a href="/wiki">Wiki</a></li>
        <li><a href="/resume">Resume</a></li>
        <li><a href="/colophon">Colophon</a></li>
        <li><a href="/now">Now</a></li>
        <li><a href="/donate">Donate</a></li>
        <li><a href="/atom.xml">RSS</a></li>
        <li><a href="#top">&uarr; Top of the page</a></li>
    </ul>
    <small>
        Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br>
        Maintained with ♥ for the web. <br>
        Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
        The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
    </small>
</footer>