Adding gems globally is sometimes done for gem install jekyll. But should really be avoided for other gems. So I'm recommending a controlled local environment with Gemfile.
Problem
Your local install docs require multiple install commands with gem install. This makes it hard to maintain and also the versions you install will not necessarily be the ones on GH Pages. e.g. GH Pages uses 1.2.3 of a gem and the latest you end up installing is 4.5.6
This is particularly important for Jekyll - GH Pages uses Jekyll 3 but you would install Jekyll 4.
Pattern
Follow the pattern from this approach and you'll see Gemfile created.
jekyll new my-blog
Recommended solution
Use approach like this file. Including two gems below Jekyll 3 which allow 3.9 support and Ruby 3 support.
Adding gems globally is sometimes done for
gem install jekyll
. But should really be avoided for other gems. So I'm recommending a controlled local environment with Gemfile.Problem
Your local install docs require multiple install commands with
gem install
. This makes it hard to maintain and also the versions you install will not necessarily be the ones on GH Pages. e.g. GH Pages uses 1.2.3 of a gem and the latest you end up installing is 4.5.6This is particularly important for Jekyll - GH Pages uses Jekyll 3 but you would install Jekyll 4.
Pattern
Follow the pattern from this approach and you'll see Gemfile created.
Recommended solution
Use approach like this file. Including two gems below Jekyll 3 which allow 3.9 support and Ruby 3 support.
https://github.com/MichaelCurrin/jekyll-blog-demo/blob/master/Gemfile#L3-L11
And then add to docs as:
And ignore
vendor
in .gitignore