Posts
all tags-
Dynamic Reading Progress Bar
Feb 10, 20251 minute readI'm sure fjall-rs isn't the first tech blog to implement a dynamic reading progress bar, but it's the first the caught my eye. Implementing it was trivially easy, though there are some browser pitfalls to be aware of.
-
Adding Videos to This Blog
Feb 10, 20251 minute readI just added in the ability to render videos in my blog, and in so doing came across a question I hadn't considered before: how do I reserve space for a video that loads after the page does? Also, are videos loaded after page load, or what's the deal there?
Turns out: yes! You can reserve space for a video. In my case…
-
Adding Interactivity
Dec 24, 20223 minute readZola is wonderful. It builds quickly, it's extremely configurable, but it is (by design) not well suited for interactive elements or complex
JavaScript
. I hadn't thought I wanted that until I saw some on Amos's site. He ended up usingiframes
to manage that integration, which is a perfectly acceptable solution. But it did make me wonder: can we accomplish the same result without all of that nasty uglyHTML
? Can we just write some cleanJS
and call it a day?Let's find out…
-
Secret Santa: a Saga
Jan 27, 20227 minute readBackstory
I have a groups of friends from college that have a Secret Santa event every year. Even after we all moved apart we've kept it up, jumping to Zoom to unwrap our gifts and guess who was our gifter. One of my most favorite traditions, a delight tempered only by the daunting task of logistics. You see, there are some constraints
-
Lithe 7 - Apples to Apples
Jan 15, 20223 minute readConfession Time
My performance testing methodology so far has been extremely flawed. It serves mostly as an indicator for how rigorous performance testing might go when I eventually get around to it. Which I think is reasonable, but it doesn't have to be quite so unfair to Svelte. Svelte is doing quite a lot more than Lithe, so I really shouldn't be comparing them side by side. It'd be good to re-run some earlier tests, but with the JavaScript equivalent of what Lithe is doing. Which, let's be honest, is mostly just parsing the HTML into an AST.…
-
Lithe 6: What about WASM?
Jan 13, 20223 minute readExcuses
I know I haven't talked much about the state of Lithe except to mention how fast it is while run natively, but that's only because Lithe is still very very bare bones. It parses the contents of svelte files into an HTML AST, which it then transforms into a more Svelte-y AST, which it then runs through to generate the final output. And it only works for the simplest of svelte files.
Thinking Ahead
But before I write more about the internals of Lithe or implement any new features, I thought it'd be a fun diversion to think ahead to when this is a smash success and absolutely everyone wants it. How are we going to package and release it?…
-
Lithe 5: Optimize for the minifier
Jan 08, 20223 minute readhalfnelson did a lovely investigation of how large Svelte projects scale. I'm not looking to rehash that per se, but I am interested in how well the current Svelte compiler's output gets minified.
For this investigation I'll be pulling as many
.svelte
files as I can. Let's use the Copilot strategy and pull from GitHub repos with permissive enough licenses. -
Lithe 4: On the Shoulders of Giants
Jan 03, 20223 minute readStarting from characters and parsing that into an AST that could render a Svelte program could definitely open open possibilities for some low-level optimizations, but even just parsing a normal HTML document is not a small project, and Svelte includes JavaScript, TypeScript, Handlebars-esque blocks, CSS, and SCSS, too. Doing all that at once would be the mother of all slogs. But, luckily, I don't have to! There exist many, many pre-build alternatives. The Svelte compiler itself even uses a couple.
So here's the new plan…
-
Lithe 3: A Rewrite
Jan 03, 20221 minute readWhat if I just copied the Svelte compiler, written in TypeScript, changed all of the file extensions from
.ts
to.rs
, and fixed all the bugs? It'd be a slog, sure, but at the end of the day I'd have a compiler that was very nearly the same, but presumably more performant.This attempt I gave a real try, spending maybe three nights just chugging away. What I got was just more and more errors, which was fairly disheartening. I also realized just how different Rust is, and that a 1-to-1 rewrite would result in something that wouldn't be as ideal as it could be. For example, take this very simple TypeScript class…
-
Lithe 2: From Scratch
Jan 03, 20221 minute readI've written a little Rust, but never professionally, so I'm sure what I write is going to be ugly to those in the know. But it compiles, which is half the battle.
Before starting this project let's take a quick peek at the Svelte repo. Oh, huh, looks like the compiler smaller than I would have thought, weighing in at only ~800KB (if you include the runtime), but 800KB of code to rewrite is still fairly massive for a weekend warrior like myself. So, for my initial attempt I crafted the world's smallest svelte app…