The case for a gem-based Jekyll theme

Written on December 10, 2017

Since the time the Jekyll project announced that they would adopt a gem-based approach to how themes should be built, I had been opposed by their decision. That is until tonight.

Tonight a person reached out to me regarding a theme they were working on. They specifically chose to go with the gem-based approach. The main reason was because they wanted to distribute the theme to several hundred folks and their main desire is to send updates simultaneously. Bingo!

All this time I had been approaching gem-based theme as a project based developer. As a developer who is only working on a one off website design, I could never understand why I’d build a theme for a Jekyll project as a gem.

My approach was to always build it in the Jekyll project itself, bundle the entire thing up and hand it off. While I think most project use cases will fall into this scenario, I can see how the gem-based approach is useful if you are building a project that should be shared across multiple Jekyll projects.

This might be an approach I think about for Jekyll Alpha, a theme I’m building. The theme is supposed to be a bare bones, lightly opinionated theme for others to build on top of. I can see how markup changes could be changed on the gem while not effecting the Jekyll project that’s built on top of Alpha. Changes like added support for different meta tags for SEO.

So while I’ve been opposed to the gem-based method for a very long time, I can now see and understand the use case for it. It might’ve also helped to carefully read through the Jekyll docs first as the Jekyll team has stated the intention of building a gem-based theme in their docs.

Gem-based themes make it easy for theme developers to make updates available to anyone who has the theme gem. When there’s an update, theme developers push the update to RubyGems.

The goal of gem-based themes is to allow you to get all the benefits of a robust, continually updated theme without having all the theme’s files getting in your way and over-complicating what might be your primary focus: creating content.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share articles like this one in your inbox. Sign up for my newsletter.