Speeding up Jekyll Generation
published 2011-11-18
One of the only complaints you'll see out there about Jekyll is that when sites get bigger, it starts to slow down.
Luckily, this is easy to fix. Unfortunately, it's apparently not obvious as you still see people complaining about it. Here's my attempt at proselytizing for Jekyll :).
If you run jekyll --help, you'll see that there's a --limit_posts option. If you set this to 1, then you'll only re-generate your most recent post when you save. This is usually exactly what you want. If you're working on a slightly older post, then bump it up to 3 or 4.
Like this:
jekyll --limit_posts 1
I've put this in a rake task
namespace :jekyll do desc "start the jekyll server in auto mode" task :server, :num_posts do |t, args| num_posts = args[:num_posts] cmd = "jekyll --auto --server --pygments" cmd += " --limit_posts #{num_posts}" if num_posts puts "running #{cmd}" exec(cmd) end end
So I can start Jekyll like this:
rake jekyll:server[1]
and only see the current post, and it's blazing fast.