November 16, 2023

svelte-masonry

Building a simple Masonry layout engine for Svelte, and thoughts on expectations of source projects

Try the demo here: https://svelte-masonry.surge.sh

npm package: https://www.npmjs.com/package/svelte-masonry

A few years back, I needed a Masonry layout for a Svelte project.

As is customary for Svelte projects — as much as I love Svelte — one usually has to build their own components, as the ecosystem isn’t as rich as React’s.

Luckily, I’d read this great CSS-tricks tutorial by the inimatble @anatudor, adapted the code to a Svelte component, and moved on. The component itself is fairly straightforward, and works really great for both blocks of text and for asynchronously showing images and other data sources. I even added a way to recalculate and resize the grid on browser resize.

At some point I thought thought hey, wouldn’t it be nice if I shared this component to the world, and put it up on Github and npm and kind of forgot about it.

A few months ago, I was doing some spring cleaning in my Github and noticed this repo. It had a handful of stars… and even few forks! …and a ton of submitted issues. It turned out people had trouble installing it or getting it to work. Now, this was mostly my fault…

Back when I put it up, I put up a large “this is NOT maintained!!” sign at the top of the repo. I’d also suggested people just copy the component code straight into their projects, rather than install via npm. This way users had complete flexibility over the component. After all, it’s just a single file, and the code is fairly well-documented.

But… that didn’t prevent people posting issues about not being able to install it. To be fair, I’d added an npm package, but it wasn’t originally packaged correctly for all node environments (e.g. commonjs vs. esm 🥲) with svelte-package, so some users were struggling to import the component.

So I love open source, and I use open source code every day.

Is it wrong to say I don’t enjoy starting and maintaining open source projects myself? Or at least, don’t enjoy doing Open Source the way you’re supposed to do it?

I actually love sharing code. I love showing people how to implement a certain algorithm or getting an LLM integration to work. But with modern state of open source repos, I think they seem to come with some amount of expectations that I’m not too fond of.

I wish there was a way to distinguish “real, actively maintained repos” from “here is a code dump, look at it, learn from it, have fun.” But I think with modern open source, you can’t just share code anymore. Code needs to have proper installation and other instructions. Issues are supposed to be taken care of; Pull requests are supposed to be reviewed. Modern open source is quite an ordeal.

Now, I’m not exactly complaining — I think it’s super cool that people care enough to post issues and do pull requests. It’s so cool someone’s forked my code for their own needs. In matter of fact, https://svelte-masonry.vercel.app/ is a demo someone else made based on my code!

And while I love to just throw some code online for people to copy — and hey they can just chuck it into an LLM anyway — I do kind of feel somewhat gross and irresponsible for doing that.

But is it irresponsible for maintainers to just put up “dirty, semi-working code in the public” like this, on Github and npm no less, and not maintain it for a few years? Even if it in large letters proclaimed it won’t be maintained?

I think there’s a difference between open source and Open Source. The former is about sharing code for the learning and the vibes. The latter is a massive monorepo with issues, PRs, discussions, releases, and 25k stars and YC sponsorship. Or at least, the latter is doing Open Source as a marketing stunt to get into YC.

Honestly, I think this is kind of ruining the other kind of open source. It adds a lot more pressure for maintainers to make the code clean and legit, and the Readme easy to follow, which in turns adds a lot more friction of sharing code. This just means that a lot of dirty code that otherwise would be chucked into the open is now sitting on a hard drive somewhere because the author doesn’t want to bother with the rest of the circus.

And though the repo quality shouldn’t always be the maintainer’s responsibility — at the risk of being a hypocrite — I always get a little miffed when I find bugs in others’ repos, which sometimes go untouched for months to years.

When I wrote the first draft of this post, back in 2023, I’d just gone back and fixed and closed all the issues, bumped the demo project from Sapper to Sveltekit, and put up a new barebones demo page showing Masonry in action: https://svelte-masonry.surge.sh.

At the time of writing this update in 2025, I finally used the svelte-package process to correctly package the component, tested the import, and updated the Install section of the readme. Surprisingly, even with the bugs, it has 300ish downloads on npm!

Between all the AI repos and open source / open core YC companies, the expectations for open source projects seems to be spiraling out of control.

The only reason I found this svelte-masonry project in the first place is because of a few Issues appeared in my Github inbox. I’m making such a deal of this and I only have a couple dozen stars. I can’t imagine what it’s like for those who get 100k+ (let alone 1k+) stars.