Running Jekyll on Windows using Vagrant
After reading a bit about static site generators I’ve decided to give them a try. One of the most popular choices is Jekyll, which is also the engine behind GitHub Pages.
One of the main disadvantages of static site generators is that they require a minimal setup on the local machine, in order to edit posts. Jekyll is based on Ruby and due to its dependencies, it’s not officially supported on Windows. There are some success stories though, but I didn’t want to have a complicated setup, especially since I may want to replicate it on other computers.
Setup
The following steps describe how to install Jekyll on Windows using Vagrant.
- Install Vagrant
- Install VirtualBox
-
Install the following Vagrant plugins:
vagrant plugin install vagrant-vbguest
-
Clone this git repo which contains the Vagrant configuration:
git clone https://github.com/greyfocus/vagrant-jekyll.git
-
Launch Vagrant
vagrant up
Workflow
- Use your favorite tools to edit the Jekyll files locally, in the Windows host
-
Once complete, connect to Vagrant over ssh:
vagrant ssh
-
Build the site (make sure you’re in the shared folder, i.e.
/vagrant
)jekyll build
You can also preview the site locally by running the builtin Jekyll server:
jekyll serve --host 0.0.0.0
and open http://127.0.0.1:4000/
in your favorite browser (on the Windows host)
Happy publishing!