Newb asking questions again. I’m editing a Jekyll theme from scratch, in a new folder, on my local machine, and when I copy all the theme files from the zip into the new folder and run the bundle exec jekyll serve on that directory in command prompt, the site shows up and works normally on localhost:4000
However, the theme readme says that after downloading the zip, I should first install the theme by running bundle install / bundle exec jekyll build
My question is (again, I’m new) why is the website working if I skip the install step?
caveat: I don’t use bundler so what I say may not be as accurate as it could be.
Bundler is a dependency manager kind of thing - it tries to make the same site install exactly the same in different places. This could be important if you have a lot of weird dependencies that are hard to get the correct versions for. For example 2 people are working on the same repo, 1st person has it all setup and wants to get the 2nd person to have the same exact dependencies installed - this could be as simple as the same jekyll version. Without bundler the 2nd person may install the latest version of jekyll when maybe that won’t work with some other thing. Bundler helps control this.
If you have a simple site without any weird plugins it is likely that it will work with different jekyll versions and other ruby gems no problem and you and I could both have it and be using different versions of things and no one will notice.
So by just doing bundle execute I think you skipped the sync step of bundle install and maybe got lucky that everything worked as it should - you probably already had all the things installed or there just aren’t any things that are picky.
My sites are simple, no external plugins or odd gems, just straight vanilla jekyll so I don’t bother with a gem file or bundler and it all just works. Usually.
Hey thanks so much for your reply! I’m very new to this and it does sound bit overwhelming googling and youtubing things around, a lot of new phrases in this for me and a lot of youtube tutorials that pop up first are just full of fluff…or I’m impatient idk
So to be properly safe, before going into any big edits, I should put the theme files in a new folder, and execute all three commands in proper order to be safe - but if I decide to work on a site later down the line, only bundle exec jekyll serve should be executed. Is this a good way to put it? Can anything bad happen if I run bundle install / bundle exec jekyll build on the same folder more than once?
As I said, I am not a bundler user, so not sure on all the best ways. I would try to not need it.
I think you only need to do bundle install if it is new or you added something to the gem file? if you have already done bundle install on the project locally I think you don’t need to do it again unless you change some dependency.
You should have a .bundle/config file that contains a reference to a BUNDLE_PATH variable which usually points to vendor.
That last folder contains all the gems installed by Bundler and every time you run bundle exec … it automatically takes that folder into account.
Bundler is a dependency manager, something similar to pip from python. It is useful for making sure you are running your application (in your case the theme) with the libraries versions it was guaranteed to work. So, it works like this: you create a Gemfile with all your dependencies, then do bundle install. It will install all dependencies with the latest version, unless a file named Gemfile.lock is already provided. If it is provided, it will install the specific versions of the libraries and its dependencies stated in that file. If it was not provided, it will create one with the version of the libraries installed.
If you have all this and then decide to add a new dependency to your Gemfile and run bundle exec jekyll serve it will fail, since the new dependency is not yet installed, is just listed. Running bundle install will then install all the missing new dependencies and add their versions to your Gemfile.lock. Check its documentation for more information.
If your theme worked from the scratch without having to install anything, it’s probably because it is a vanilla jekyll site like the ones from @rdyar, or you already have these dependencies installed in your global ruby setup. About this, I would recommend creating virtual environments to isolate the ruby version you are running for your theme. rbenv is useful for this, and if you don’t know how to use it, I wrote about how to install it a while ago, when I was starting playing with jekyll sites.