How To Make Jekyll Build Process Faster?

Dear All

I use Jekyll on Netlify. Also I avoid liquid on my Jekyll website. So, I move all the code on includes to layout.

I set my config.yml like this to make building process faster ->

exclude:

  • Gemfile
  • readme.md
  • node_modules
  • .gitignore
  • .jekyll-cache

My posts less than hundreds. And I don’t use any images yet. But the building process take almost half minutes. How to make it faster?

Note:
I’ve read many articles out there to reduces building process time. But the result still not significant.

Regards

I’m going to assume you searched through previous posts and read up on some of the suggestions there.

Other things you might try is installing the Jekyll 4 beta and/or using Jekyll’s incremental build option. Other than pulling asset building out of Jekyll and into something like Gulp/Grunt and not being careful how you use {% for %} loops, there’s not much more optimizing you can do.

1 Like

Thanks for reference.

@mmistakes @BayuAngora My deploy command on Netlify is jekyll build. For each build it will take around 4 minutes. In local, I can serve with incremental by running jekyll serve --incremental.

Is there a way to make Netlify deploy with incremental build option? If yes, what is the command I should put in Netlify?

@BayuAngora have a look at timestamps in the log on Netlify to see where the longest part is.

Netlify already caches dependencies so this saves time.

I like Jekyll 4 - it has a cache feature which makes builds go from over a minute to just one second. I do not know if Netlify also caches that cache each time.

There is also part of the Netlify build to propagate your changes to CDNs around the world and any other clean up stuff.

@shafiemukhre I would recommend against the incremental option in production.

Firstly, Jekyll 4 already uses a cache already so that repeat builds (including Jekyll serve) after fast, after your stop and start the server. As in my comment above this made a build 60x faster for me.

Secondly, the incremental flag is not safe for accurate output. I have used it locally as part of the serve command. When I edit a post for example to have a different title, then on that post URL specifically the HTML output pages.
But… anywhere where you reference that post are not updated. E.g. if you have a homepage which lists all post titles and descriptions. The incremental build doesn’t see that page as directly changed so it doesn’t update. Which means in production you’d get inaccurate data too.

I can recommend this

jekyll build --profile

You’ll get a table and you can see which pages are causing the most computation expenses.