tocttou / hacker-blog

Hacker-Blog is a minimalistic, responsive jekyll theme built for hackers. https://ashishchaudhary.in/hacker-blog
Creative Commons Zero v1.0 Universal
319 stars 554 forks source link

create Gemfile and bundle install instructions #24

Open MichaelCurrin opened 3 years ago

MichaelCurrin commented 3 years ago

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.

https://github.com/MichaelCurrin/jekyll-blog-demo/blob/master/Gemfile#L3-L11

And then add to docs as:

bundle config set --local path vendor/bundle
bundle install

And ignore vendor in .gitignore