Tuan-Anh Tran

Speed up jekyll site generation with rsync

Posted on July 26, 2014  •  2 minutes  • 214 words

Jekyll doesn’t support incremental generation so if your site contains loads of static assets like image, audios,.. jekyll is gonna stroke everytime you re-generate your site by deleting and re-generate/re-coppying everything. This little trick below will help you speeding up jekyll generation process by skipping all the static assets that you specified, until jekyll comes up with a better solution.

keep_files: ["images"]
module Jekyll    
  class RsyncImageGenerator < Generator
    def generate(site)
      system('mkdir -p _site');
      system('rsync --archive --delete _img/ _site/img/');
    end
  end
end  

From now on, jekyll will ignore the _images folder in your source and images in _sites folder when generating your site. We keep it in sync by using rsync, which is much better/faster than delete/copy process jekyll is using.

Github Pages does support jekyll gems now but it’s kinda limited.

Follow me

Here's where I hang out in social media