Once your Jekyll site starts to get larger, it will take seconds to build every time you save a file. I’ve seen a number of articles on this topic, but few people know about the quickest fix of them all:
Instead of using
jekyll serve to run your development server, use
jekyll serve -I. This rebuilds only the file you’ve saved – not the entire site. This helped me reduce my build time from ~2.5s to 0.25s.
The only time you want to use
jekyll serve is if you’ve created a new file. In other words, if you’re only editing existing files, use
jekyll serve -I.
Finally, I recommend setting up an alias for this command. I use
ser (as in “server”) since it’s easy to type and remember:
alias ser="jekyll serve -I"
If that’s still too slow, you might be interested in my post on static site generators where I review Jekyll, Hugo, Gatsby, Next, Zola, and Eleventy.