Is it possible to pack a plugin in a gem-based theme

Hi there,

I’m developing a custom theme for Jekyll, and I need few trivial helper plugins to implement custom tags. I know that I can pack _plugins in the contents repository or else make a new gem for it, but it’s such a hassle for a few trivial plugins. I tried to pack _plugins within a theme, but the tags are not being picked up. Any other options I’ve missed?

Many thanks!

–Yury

In the mean time, I’ve got the following idea:

  1. Add a lib subdirectory to my theme with jekyll-my-theme.rb
  2. Add jekyll-my-theme to the gems section of _config.yml in addition to theme

Seems to work for me, any feedback?

Currently, this is not possible, though your workaround is a nice solution.

Tip: The entry to gems: array need not be named jekyll-*. i.e. if your theme is called omega-jekyll, the .rb file need not be named jekyll-omega-jekyll.
omega-jekyll will do just as fine.



In future, if you do plan to release the plugins collection as a rubygem, there’s a PR slated for Jekyll v3.5 that will automatically require runtime_dependencies of gem-based themes. With that in place, end-users of theme-gems need not add the plugins required by the theme to their config-file’s gems: array.

Gem::Specification.new do |spec|
  spec.name       = "omega-jekyll"
  spec.version    = "0.1.0"
  spec.authors    = ["John Doe", "Jane Doe"]

  spec.add_runtime_dependency "jekyll", "~> 3.5"
  spec.add_runtime_dependency "jekyll-sitemap", "~> 1.0"
  spec.add_runtime_dependency "omega-jekyll-plugins", "~> 0.1"
end
# _config.yml

theme: omega-jekyll
gems:
  - jekyll-admin

Building a site with above will have all the 3 plugins activated.