Updating Jekyll to Ruby 3.2.0
I recently updated this blog to Ruby 3.2.0 which was released on Dec 25, 2022. I expected this to be a minor update since I came from Ruby 3.1.2. However, I ran into some problems that I had to solve.
Outdated API
It turns out that there is one important change in the Ruby standard library.File.exists?
was renamed to File.exist?
with the same functionality. Some third-party plugins that I use have not yet included this change. I was able to extend the File
class like so:
I added this file as in the _plugins
folder so that Jekyll would import it automatically.
Updating Jekyll
The version of Jekyll that I used was not compatible with Ruby 3.2.0. I had to update myGemfile
to the following and then run bundle update
. This will apply updates to Jekyll automatically in the future.
SASS Compiler
With the Jekyll update came also an update to the SASS compiler. Mycss
folder contains one file: main.scss
. This file has just some import statements that it uses to assemble a larger CSS file. I got an error message that instead of the ;
at the end of each line, curly braces are expected. I spent quite some time to try to figure out what is going on, until I saw the changelog on the Jekyll homepage. It turns out that the main.scss
cannot have the same name as the imported _main.scss
. After renaming it to _base.scss
, it worked. See the last line in the snippet below for an example.
After those steps, everything worked again and this site is now generated with Ruby 3.2.0!