Home > other >  Why some themes in jekyll require different versions of jekyll?
Why some themes in jekyll require different versions of jekyll?

Time:12-11

I was browsing rubygems.org for themes in Jekyll and they were causing trouble with the current versions of jekyll.

Like here I was trying out linaro-jekyll-theme. and I got this

Fetching gem metadata from https://rubygems.org/......... Resolving dependencies.... Bundler could not find compatible versions for gem "jekyll": In Gemfile: jekyll (~> 4.2.1)

linaro-jekyll-theme was resolved to 1.0, which depends on
  jekyll (~> 3.4)

Bundler could not find compatible versions for gem "linaro-jekyll-theme": In snapshot (Gemfile.lock): linaro-jekyll-theme (= 1.0)

In Gemfile: linaro-jekyll-theme

Running bundle update will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict.

How to change jekyll versions according to the needs. Is there any problem associated with changing versions so many times?

CodePudding user response:

A Jekyll theme (or any gem in general) might depend on a certain version of another gem because

  • is depends on certain features that were removed or changed in later versions or
  • the author just pinned the version as a reminder to check compatibility when a new major version is released because major releases might break the gem.

In this example, the author might already have known that their gem works with Jekyll 3.x but not with 4.x anymore or they just wanted to revisit the theme later if it still works with Jekyll 4.x but never did.

Changing versions is not really a problem and because of bundler you can do that easily and as often as you want or need to. But there might be a general issue with downgrading a gem. Newer versions are released mainly for two reasons:

  1. to add new features and
  2. to fix bugs and security vulnerabilities.

When you work with an older version of a gem then you might miss new features that might be okay if you do not need them. But you also might open yourself to security vulnerabilities that have already been fixed in later versions.

My advice is:

  • Try using the latest version of a gem whenever possible.
  • If another gem depends on an older version and you, therefore, an update to the latest version, then I would ask myself if it is really worth it to use such an outdated gem. When the gem hasn't been updated to depend on the latest version for a longer period of time then it is likely that it will not be updated anymore which is a risk.
  • If you still want or need to downgrade then I suggest checking the changelog of the gem what features and bug fixes you will miss. And to check the changelog on a regular basis in the future too.

Useful links in this context: The list of Jekyll versions, as you can see Jekyll 3.4 is about five years old that is a lot of time to build new features, fix bugs and security vulnerabilities. And a lot of time for a theme author to make a theme compatible with newer versions. And the Jekyll Changelog in which you can check what you would be missing when you downgrade to 3.4 instead of using the latest version (currently 4.2.1). And that list is very long.

  • Related