Lume Tufte
- 4 Devlogs
- 15 Total hours
General-purpose Lume theme based on Tufte CSS.
General-purpose Lume theme based on Tufte CSS.
Unless I think of more stuff to add, this is probably my last devlog before shipping.
A few hours ago, the PR that I created last devlog was merged into the official Lume theme registry, so you can now install my theme with a single command using Lume init, and it now has its own dedicated page on the official Lume website: https://lume.land/theme/tufte/.
I’m not going to ship this project juuuuust yet in case I think of any missing features that I ought to add, but I probably will soon.
I just created a PR to add my theme to the official theme registry for Lume: https://github.com/lumeland/themes/pull/10.
If my theme isn’t in the official registry, the best way for users install it is to clone my entire repo, which is silly, bad for separation of concerns, and just generally worse for UX.
git clone https://github.com/ethmarks/lume_tufte.git
cd lume_tufte
deno task serve
But if I get my theme into the theme registry, users can install it using the official Lume init command, which is much better in every way:
deno run -A https://lume.land/init.ts --theme=tufte
From my interactions with him in the past, the Lume maintainer (Oscar) seems like an extremely nice dude who seems to respond fairly quickly, so I shouldn’t have to wait too long before he either accepts my PR or suggests changes that I can go implement. Meanwhile, I’ll probably continue working on the README.
Since my last devlog:
Link to the diff between last devlog and this one
Most of the work I did today is pretty self-explanatory from my little summary, but the optimization work probably merits elaboration.
So while I was writing the README, I had the idea to include the Lighthouse scores. When I checked, they were 100/100/100/92 on mobile and 92/100/100/92 on desktop.
“100s on Lighthouse in some fields” doesn’t sound nearly as nice as “100s on Lighthouse in every field”, so I decided to start optimizing. Lighthouse told me that the SEO problem was a lack of descriptions, and the desktop performance problem was excessive network requests and chained network requests.
I fixed the lack of descriptions by adding descriptions. Simple as that. I wrote descriptions for all of the existing pages, added a description field to the CMS config, and added a mention of it in the usage guide. The network requests and chained requests were a bit trickier to solve.
The cause of the excessive network requests was that, even though the homepage didn’t use the KaTeX or Nueglow styles, they were still being imported. I solved that with a per-page check that runs at build time. Each page only imports the Nueglow stylesheet if it contains code blocks, and it only imports the KaTeX stylesheet if the page contains math blocks. Here’s a link to the relevant section of code. I think that it’s a pretty clever solution because it selectively removes the unnecessary CSS requests without using client-side JS or anything like that.
I used a similar approach to solve the chained requests. What was happening is that in order to download the woff2 files, the browser first had to download the CSS files, so it took twice as long because they couldn’t be downloaded in parallel. Font preloads are the way to solve this. The only problem is that if I preload too many font files, the browser will have download font files even if they aren’t used on the page. But if I preload too few, then the network requests are still chained. My solution was to have it check which font files each page needs and selectively preload only those font files. Here’s the relevant code if you want to see my implementation. Again, this solves the problem of unnecessary requests and chained requests without adding any client-side JS.
I’m glad that Lume and Vento are such powerful tools that I can easily do programmatic optimizations like this.
I think that the next thing I should do is submit my theme to the official Lume theme repo. That way I can simplify the installation process down to one command.
Hi there! This is a project I’ve been working on for the past week. It’s a theme for Lume SSG based on Tufte CSS.
Btw, I did the majority of the work before I started using Hackatime, so I’ve been working on it for a lot longer than 5 hours.
I’m just going to briefly tell you about everything that I did before I started tracking with Hackatime.
Most of what I’ve done since then (what’s reflected in the 5 hours I’ve logged with this devlog) has been a lot of writing, mainly in the Using this theme post. I’ve also been adjusting the LumeCMS config a lot.
I think that the next thing that I’ll do is write the README.
Thanks for reading!