Update 10-11-2022: cygwin still works, but why not use Windows Subsystem for Linux (WSL) instead!

#Jekyll Development on Windows With WSL
#https://davemateer.com/2020/10/20/running-jekyll-on-wsl2

sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt install ruby-full
sudo apt-get install make gcc gpp build-essential zlib1g zlib1g-dev ruby-dev dh-autoreconf

sudo gem update
sudo gem install bundler

sudo gem install jekyll

jekyll new my-awesome-site
cd my-awesome-site

# inside jekyll repo
bundle install

# simple serve
bundle exec jekyll serve

Cygwin is “a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.”

Sounds like a good tool to enable using Windows for Jekyll web development. You can install Cygwin with Chocolatey with this command:

choco install cygwin

Or download from https://www.cygwin.com/.

Install these packages during Cygwin install:

  • libyaml
  • ruby
  • python: Python language interpreter 2.x
  • gcc-core
  • gcc-gcc++
  • make
  • ruby-devel
  • nano

After install, run these commands in the Cygwin terminal (replacing USERNAME with your username):

export PATH="$PATH:/home/USERNAME/bin"
gem install bundler jekyll
PATH="$PATH:/home/USERNAME/bin" to .bashrc

That’s all we need to get to a place where we can spin up a new jekyll site. Create a new site with these commands:

jekyll new my-awesome-site
cd my-awesome-site
chmod -R 777 /usr/share/gems
bundle install 
bundle exec jekyll serve

Browse to http://localhost:4000 to test your site.

Modify files in C:\tools\cygwin\home\USERNAME\my-awesome-site and then use command this command to compile to html:

bundle exec jekyll build

Then serve the site again to test.

bundle exec jekyll serve

When you are ready to move your site to a production web server, set the variable “JEKYLL_ENV” to “production” and build again. You can do both with this command:

JEKYLL_ENV=production bundle exec jekyll build 

Then copy the files in _site to your webserver.

Setting the “JEKYLL_ENV” is not strictly necessary. By default the “JEKYLL_ENV” is set to “development.” Your site will work either way in your development environment and in production, but setting the variable allows for automatic changes between the dev site and the prod site, like the inclusion of Google Analytics in prod and not in dev.

Further Reading:
https://www.cygwin.com/
https://jekyllrb.com/
https://jekyllrb.com/docs/configuration/environments/
https://davemateer.com/2020/10/20/running-jekyll-on-wsl2