This article is over 4 years old, it may be outdated!
Published on 12/16/2015 | 16.12.12015 HE
I was researching how to speed up a Jekyll site and if there was any news or whatsoever from the Community when I found an old issue on GitHub with a comment by Parkr that pointed me in the right direction: The
guard-jekyll-plus Gem. As a person who has no idea of Ruby other that it has a rather beautiful looking syntax and
Gems are somewhat related to it, I went on and set up the “environment” and programs needed. These were, basically,
Gemfile and a
# on Ubuntu $ (sudo) apt-get install bundler
# The Gemfile source 'https://rubygems.org' gem 'guard-jekyll-plus'
# The Guardfile # Taken directly from https://github.com/imathis/guard-jekyll-plus ignore /^_site/ # NOTE: this can interfere with Guard::LiveReload guard "jekyll-plus", :serve => true do watch /.*/ end
Gemfile - which seems to be a list of dependencies, similar to the
dependencies list in a
package.json file for Node - is probably the most basic representation of such a file. I first put in only the
gem 'guard-jekyll-plus' line but then it started to throw errors and said I need to define a source - which I then did. Case closed, moving on.
The Guardfile is directly taken from The guard-jekyll-plus GitHub repository. As far as I understand it runs the watching and serving (normaly done by
jekyll --watch) through the
Guard task runner (
task runner might be super simplified here) - so
guard-jekyll-plus now decide when to rebuild things and what needs to be rebuild.
Once the configuration is set up you can run
$ bundle install to install the dependencies and then
$ guard to start the guard process. Guard will then run, serve up the Jekyll site on
localhost:4000 (or whatever is specified in jekyll
_config.yml) and watch the files. From my previous 17-20 seconds of build time I am now down to 1.2 seconds. ONE POINT TWO SECONDS - this is amazing! Roughly 15x faster than just with Jekyll alone.
I have no idea why there is no mention of this method on the official Jekyll Website. Everyone who uses Jekyll and is frustrated with slow build times should consider looking at
jekyll-guard-plus. I can highly recommend it.