1
votes

I have an custom generator written for creating archive pages (per year, month and day) for my Jekyll blog. But that generator takes some time, can I disable a generator for non-production environment or maybe from the plugins entry in the config?

UPDATE: The plugin is just placed in the _pluginsfolder, it is not delivered / distributed as gem package!

I am looking for a kind of blacklisting of generators (and maybe also filters or other plugins) for development environment to save building time.

1
stackoverflow.com/a/45693637/10655742 def generate(site) for Generators. So I can change it in code for my own generators, but what about 3rdParty generators via gem?KargWare

1 Answers

0
votes

Local Plugins

For switching local plugins, you could use two different folders, and switch between them with a combination of multiple config files overwriting your plugins_dir.

You would set the a different value for plugins_dir field in the _config-dev.yml file which would overwrite your value in _config.yml (or the default _plugins if unset):

$ bundle exec jekyll build --config _config.yml,_config-dev.yml

This way you can have two folders with your development and production plugins separate. This has a maintenance cost when you use a plugin across both environments.


Gemfile Plugins

For switching gem-based plugins, you could use a different Gemfile for development without the production plugins:

BUNDLE_GEMFILE=Gemfile-dev bundle exec jekyll build

This gives you a lot of flexibility at the cost of maintaining two files. You'd want to ensure the versions of plugins across both are the same.

Alternatively, you could use an additional config file for development. You would set the a different value for plugins field in the _config-dev.yml file which would overwrite your value in _config.yml. You'd need to ensure your plugins are not set in the :jekyll_plugins group in your Gemfile for this to work (as this would shortcut the config setting):

$ bundle exec jekyll build --config _config.yml,_config-dev.yml

General Performance

If your site has a large number of posts, it's likely that your biggest time saving would be made by processing less of them at development time. You can do this with the limit_posts command line option (https://jekyllrb.com/docs/configuration/options/#build-command-options):

$ bundle exec jekyll build --limit_posts 5

For general build time improvements, I'd highly recommend profiling your site to find the best place to optimise:

$ bundle exec jekyll build --profile