Building just specific pages when developing

Our Jekyll site now takes nearly a minute to build. Is there a way (plugin or otherwise) to just build specific pages when developing?

(limit doesn’t work as only a small part of the site is posts)

1 Like

When you use the --incremental CLI switch (e.g. bundle exec jekyll build --incremental or bundle exec jekyll serve --incremental) or have incremental: true in your config file, Jekyll will first build the entire site. Consequent build invocations will only process and render those pages that have changed since the previous build invocation.

1 Like

Thanks - I’m finding --incremental does reduce build time by about 20 seconds, but even for a simple markdown change to just one page it’s still taking around 40 seconds to build.

It may not be building just the one page then.
Incremental build doesn’t take plugins into consideration. So if you have 10 pages generated by a plugin, then all those 10 pages will be regenerated on every cycle.

So, I’m guessing that this perf issue is because of some plugin…

If possible, post a link to your repository if it is public or try debugging yourselves by using the --verbose and --profile CLI switches:

bundle exec jekyll build --incremental --verbose --profile

Unfortunately it’s not public, but i’ve gone ahead and run verbose and profile.

Even though i’m only making a change to one individual markdown file or layout, that aren’t part of any collection:

  • Verbose is showing rendering, pre-rendering etc. for all the collections we have e.g. _clients, _teams
  • Profile is showing count of 109 for our default template. If you sum up all the times shown in the profile table though it looks like it’d only total 5 seconds or so compared to build time of ~40 seconds.
  • There’s a long delay when between the terminal saying: Writing Metadata: .jekyll-metadata. In fact that steps taking ~ 30 seconds.
  • We are using jekyll-paginate-v2

Thanks again for your help.

You could try disabling the jekyll-paginate-v2 plugin (by commenting out the gem in the config file and Gemfile) and check how long the build time is…

Thanks! Some progress: It turns out we were using extra plugins i wasn’t aware of

  • ‘jekyll-autoprefixer’
  • ‘jekyll-paginate-v2’
  • ‘jekyll-seo-tag’
  • ‘jekyll-sitemap’

Removing autoprefixer seems to have made the biggest difference. It’s reduced build time with incremental to about 10-15 seconds (so down about 30 seconds).

The profile table is still showing high counts - e.g the default.html layout is invoked 99 times even when only changing a layout used on one other page.

if you move the asset processing to Gulp or some other task runner you can speed stuff up quite a bit. Gulp can process sass almost instantly, so if you are just working on css then that is much easier - but it also removes that step from jekyll so it makes the rest of what jekyll does faster. Gulp can also move the images which is another thing that takes time for jekyll to do. I have my site so that jekyll mainly handles the page creation/layouts/includes. Gulp handles sass, js and images.

Check this post for info on what I did and also info from MM on how he does it. It can be a little complicated if you are not familiar with Gulp, which I was not, but I got the hang of it.

1 Like