It’s always a good idea to verify changes locally before pushing them to GitHub. This avoids potentially breaking a site, or having to a push simply to visualize your work (only to realize a minor typo and then stage-commit-push a second time). To do this you need to run Jekyll locally on your computer and then point your browser at your localhost. Unfortunately Jekyll is coded in Ruby which can be tricky to install on Windows. Follow these one-time set-up instructions then at the bottom, the new command for running a Jekyll site from your computer:
Check if Ruby is installed
- Open a DOS command Window (press the Windows key and then type
cmdand hit enter)
- Type the command
ruby --versionto check if you have Ruby installed and which version you might be running.
- If you get “command not found” because Ruby is not installed then proceed to the next section.
- We need a Ruby version that’s equal to or newer than 2.1.0 so reinstall Ruby if you have an older version.
Install Ruby (if necessary)
- Download the Ruby installer. You want: Ruby+devkit 2.6.4 (exact number doesn’t matter. Just choose the greatest Ruby+Devkit version)
- Run the installer and choose all the default choices.
- When the command line choice comes up choose Base installation
1 - MSYS2 base installation <------ choose this one: (1) 2 - MSYS2 system update (optional) 3 - MSYS2 and MINGW development toolchain
At the second prompt just hit ENTER to get out.
Now go back to Step 1: Check Version of Ruby. There’s no point in proceeding if you’re running an old version or the installation failed.
Back at the DOS command window, type the following command:
gem install bundler
Site-level (Do this for every site you want to serve locally)
- Open a DOS command window in the
/docsfolder of the site you want to serve.
- Run the following command to install all the necessary components needed for the current site:
Serving a site locally
With the one-time steps above complete, you’re good to go. You shouldn’t have to run bundler install again and can just run the following command every time you want to serve a site:
bundle exec jekyll serve