Exclude jekyll-feed in development environment?

Is it possible to disable jekyll-feed when the environment is development?

Thanks.

To my knowledge, there’s no option to disable jekyll-feed.
But may I ask, why you want it to be disabled during development…? It has minimal effect on the overall build times.

Thanks for the reply, and yes, by all means, ask! Maybe you can suggest some alternatives. :grinning:

I have only 50 posts, and jekyll-feed adds about 5 seconds to the build time. Obviously as I create more posts, that number will only grow.

This wouldn’t be a problem, except I have a habit of constantly needing to see what the post looks like while I’m composing it, and the delay has a definite impact.

The main reason I feel the need to constantly look at the results is because my blog posts have a lot of pictures, with them justified left and the corresponding text on the right. Here’s an example: https://thenewbiewoodworker.com/poweredup/2019/02/27/powered-up-2-12-1.html

I suppose the best answer is to wean myself from needing to always look at the results, but I’m a very visual person. Got any other ideas?

Thanks!

How did you reach to this conclusion?
Are you developing on Windows?

A few:

  • If you’re on Windows, ensure that you’ve listed   gem 'wdm' in your Gemfile.
  • Use the --incremental switch (shorthand:-I) to process only those files that change:
    bundle exec jekyll serve -I
    
    Now, when you make changes to a particular “post” or “page”, only those and their layouts / includes are “re-processed”. The feed will still be generated but the total build time will be much lesser.
  • You can always disable a plugin by commenting it out in the _config.yml
    plugins:
    # - jekyll-feed
    - jekyll-sitemap
    
    and uncomment before commiting changes.
  • You can maintain two separate config files if the above is tiresome. For example, a regular _config.yml for production builds on GitHub Pages and the other named a _config_dev.yml for local builds.
    Then simply use the latter as following:
    bundle exec jekyll serve --config _config_dev.yml
    

Note: For either of the last two options to work you’ve to ensure the following:

  • you’re not using a “theme” that has listed jekyll-feed as its dependency / runtime_dependency.
  • you’ve not listed jekyll-feed in the :jekyll_plugins group in your Gemfile.

Thanks for the great reply!

How did you reach to this conclusion?

By misunderstanding the output in the Terminal window. :roll_eyes: Thanks for making me take another look at it. Sometimes I can be so blind to the obvious.

image

I read this as saying it took jekyll-feed 4.7 seconds to generate the feed, when of course it’s saying it took that amount of time for the entire rebuild. D’OH!

Use the --incremental switch (shorthand: -I ) to process only those files that change

It seems to me that the last time I tried this, it didn’t work all that well, but I’ll have to try it again before I can say for sure what makes me think that.

You can maintain two separate config files

That is exactly what I wanted. Or would have wanted, if I had been correct about how long it takes to generate the feed file. Regardless, this is very helpful, because I’m sure I’ll have a use for it in the future.

Thank you so much for taking the time to help! Very much appreciated.

1 Like

You’re welcome.
As an aside, if you remove jekyll-feed from the :jekyll_plugins group in your Gemfile, you’ll get a Dependency missing error.
To correct, simply list jekyll-feed anywhere in your Gemfile, but outside the :jekyll_plugins group.

Thanks!

This is what I have in my Gemfile:

source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
gem 'jekyll-sitemap', group: :jekyll_plugins
gem 'jekyll-seo-tag', group: :jekyll_plugins
gem 'jekyll-feed', group: :jekyll_plugins

If I can list jekyll-feed without the group, then what’s the purpose of specifying a group?

Thanks again.

Disclaimer: This can get a bit technical. I’ll try and keep it simple…

Honestly, the purpose is only simplification. It is not a requirement.
Technically, any gem listed in the :jekyll_plugins group will be automatically “loaded” by Jekyll even if it is not listed as a plugin in the config file.

The simplification is that one does not have to make changes at two places (Gemfile and a config file)

Now, if you’re wondering “what’s the purpose of the plugins configuration”, the reason is that some strict environments like GitHub Pages does not include Bundler,(a program that Jekyll uses to automatically load gems within the :jekyll_plugins group). to control what gets loaded, with an iron-fist.

Do not add github-pages in the :jekyll_plugins group. This gem is already a composite of
jekyll, jekyll-feed, jekyll-seo-tag and some other plugins.

And since that one gem is a composite, you need not list the other plugins as well.
So, ultimately, your Gemfile just needs to be:

source 'https://rubygems.org'
gem 'github-pages'

Enabling a plugin can be delegated to the config file:

plugins:
  # - jekyll-feed
  - jekyll-seo-tag
  - jekyll-sitemap

Disclaimer: This can get a bit technical. I’ll try and keep it simple…

I don’t mind technical. I’m a (retired) developer. Unfortunately, I was a Windows developer, so there’s a lot of “basic” stuff that I know nothing or very little about (like Gems, etc) but I’m learning. (But see my rant below if you care.)

Do not add github-pages in the :jekyll_plugins group.

Disclaimer: I didn’t create the Gemfile (at least not to my recollection). I’m not sure how I got it, but in the end, who cares?

I changed my Gemfile as you specified, and I already had the config file lines. It cut my build time almost in half. Of course I don’t have a large site so everything’s relative, but hey, 2 seconds is 2 seconds, right?

I can’t thank you enough for spending some time helping me. I wanted to make that clear, before the following rant. ;p

This is a rant, just because I need to vent. Feel free to totally ignore it.

I don’t expect answers. I just have to get this out of my system.

Disclaimer: I’m a retired Windows developer, but I’ve been a Mac user for 10 years or so. I have loyalties to both camps, and I am not a platform snob, even if I have my preferences. Whatever works, works.

I wish there was a place where people like me could go to learn all the Unix/Linux/whatever you call it stuff, like bundles, gemfiles, etc. It’s all so foreign, and almost all of the information available assumes I already know a lot of things.

Here’s an example:

I’d be reading something, and it might mention “gems”. So I’d have to go and learn what “gems” are, which would lead to things like “bundle” or “homebrew” and the like, and I’d have to learn what they are. And on and on it would go, one term being defined by other terms I don’t know.

Then I’d run something like Bundler, and it outputs hundreds of lines of text, and I’d have no idea if I’m supposed to care about it or not. Sometimes a module would show an error, and I wouldn’t have a clue what to do. I’d try to search for an answer, only to be led further down the rabbit trail of definitions.

I’m technically quite adept. I’m a very fast learner. I just want a primer to help get me up to speed. But I feel like Amy Adams in “Arrival”, trying to understand the aliens’ language.

End rant

I feel so much better now.

1 Like

Start at the following link:

1 Like

I’m also trying to exclude Jekyll feed from Dev environment. I’m already using 2 different config files for Production and Dev. I have excluded jekyll-feed plugin from the dev config file, but Jekyll Feed still runs.

_config.yml:
plugins: [jekyll-paginate, jekyll-sitemap, jekyll-feed, jekyll-last-modified-at, jekyll-assets]

_config_dev.yml:
plugins: [jekyll-paginate, jekyll-assets]

start.dev:
bundle exec jekyll serve --port 3000 --incremental --config _config.yml,_config_dev.yml

Am I missing something?

Thanks.

Ensure that you’ve not listed jekyll-feed in the :jekyll_plugins group in your Gemfile.
For further control, build your site under --safe mode and whitelisting the required plugins:

# config_dev.yml
safe: true
whitelist: [jekyll-paginate, jekyll-assets]
plugins: [jekyll-paginate, jekyll-assets]