John F. Miller
John F. Miller

Reputation: 27217

Jekyll recompiles every page every time

When I run jekyll to generate my site, it regenerates every page. How do I tell it to generate only pages which are new or have changed?

Alternatly, what am I doing to make Jekyll think it need to recreate every page?

Upvotes: 3

Views: 1381

Answers (3)

Erkki Teedla
Erkki Teedla

Reputation: 319

For speeding up local development you can use --limit_posts NUM to limit the number of posts to parse. This can lead to significant time saving for sites with a lot of posts.

See https://jekyllrb.com/docs/configuration/#build-command-options

Upvotes: 1

mipadi
mipadi

Reputation: 410662

Jekyll automatically regenerates the entire site each time it runs -- that's just how it works. However, I believe it will only regenerate changed files if you pass the flag:

--watch

as in:

jekyll build --watch

Note: Instead of jekyll build --watch, older versions of jekyll use jekyll --auto.

Upvotes: 7

Carlos Agarie
Carlos Agarie

Reputation: 4002

As mipadi said, Jekyll regenerates the entire site when compiling it. However, the --auto flag makes it compile the whole thing, always.

It does this because, as elithrar said, each post/page can depend on one another and, as it's all decided during compile time, it can't be generated on the fly like it would in WordPress or Tumblr. So, to avoid broken links, everything is regenerated.

This can be problematic on the long run. For example, very big sites (>1000 posts) report extremely long compiling times with LSI enabled, which was addressed with some configuration options lately. And there are other problems, i.e. if you're dealing with CSS/JS (or LESS, SASS, CoffeeScript, be my guest), why would you recreate the whole thing?

This is a recurring discussion on Jekyll's issue list, so if you guys can think of a good solution, please post it there.

But, sincerely? If your site is small enough, just let it regenerate everything. It's much simpler this way.

Upvotes: 2

Related Questions