在 jekyll 中加载本地库(Liquid 模板库 + ruby bundler)

Loading local libaries in jekyll (Liquid template library + ruby bundler)

我的问题是:如何在 ruby 中使用 bundler + jekyll 加载本地库?

我正在尝试加载一堆本地库。 例如:project_root/_plugins/fileexists.rb

我试过遵循 https://jekyllrb.com/docs/plugins/ 但该解决方案假定您有一个可以从全局 Gem 存储库安装的库。

我要加载的插件在这里https://github.com/nicnocquee/appolo/tree/master/_plugins

我在执行 'bundle exec jekyll serve' 时遇到的错误:

Dependency Error: Yikes! It looks like you don't have fileexists or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- fileexists' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!

为了使事情复杂化,我使用的是 Liquid 模板库。 (尽管这不应该是 Liquid 的问题,因为我在执行 bundle exec jekyll serve 时遇到错误。我认为..)

{% file_exists {{ fb_img_default }} %}

模板的代码在这里: https://github.com/nicnocquee/appolo/blob/master/_includes/head.html#L25

我的 _config.yml jekyll 文件:https://pastebin.com/SphuLcVt Gem文件:https://pastebin.com/3ptcBx5m

提前感谢您提供有关如何进行的想法!

库版本

捆绑包--版本 捆绑器版本 1.16.0

ruby --版本 ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]

gem --版本 2.5.2

好的,我明白了。

我删除了:

plugins:
 - fileexists

来自_config.yml

并删除:

gem 'fileexists', :path => '/home/test/xxx.github.io/_plugins/fileexists'
gem 'github-pages'

来自 Gemfile

github-页数据包问题的线索:https://github.com/jekyll/jekyll/issues/5990#issuecomment-308231021

简答: "No custom plugins will load when using github-pages because of their whitelist."