[Solved] How to disable certain Gems for a different build of files


#1

I have the following problem:

  • I have documents in the asciidoc-format with an extension of .adoc in _posts.
  • A superb gem called jekyll-asciidoc converts the .adoc-files to HTML.

Now I want to make a different build with _configbook.yml where the jekyll-asciidoc gem/plugin is disabled. In this config-file I disabled the gem, it’s not listed under gems:.

But when I run…

bundle exec jekyll build --config _configbook.yml

…the jekyll-asciidoc plugin converts my files again. If I delete the plugin from Gemfile it works like I want to.

Is there a way to disable a jekyll gem without deleting it from the Gemfile each time i don’t need it?

This is how my Gemfile looks

source "https://rubygems.org"
ruby RUBY_VERSION

gem "jekyll"

group :jekyll_plugins do
  gem 'jekyll-feed'
	gem 'jekyll-gist'
	gem 'jekyll-sitemap'
	gem 'jekyll-paginate'
	gem 'jekyll-asciidoc'
	gem 'jekyll-seo-tag'
end

#2

move jekyll-asciidoc outside the :jekyll_plugins group. Then it wont be required while using the _configbook.yml config file.

source "https://rubygems.org"
ruby RUBY_VERSION

gem "jekyll"
gem 'jekyll-asciidoc'

group :jekyll_plugins do
  gem 'jekyll-feed'
  gem 'jekyll-gist'
  gem 'jekyll-sitemap'
  gem 'jekyll-paginate'
  gem 'jekyll-seo-tag'
end

#3

Perfect. It works. Thankyou @ashmaroli for your help this was perfect advice :slight_smile: