If I have a gem containing shared assets (sass, JavaScript, images etc) for a site, is there a straightforward way to pull those assets into a Jekyll build?
I know I could unpack the gem into the Jekyll project directory, but I was thinking there should be some way to access the assets having declared the dependency in the [gems] section of my _config.yml.
Related
Lately I've gotten into Jekyll for building documentation sites and hosting them on Github Pages. I understand Github Pages has a very limited list of what is allowed plugin wise. While doing some vulnerability testing I found out the file Gemfile.lock is vulnerable to XML External Entity (XXE) Injection.
In my research I've read:
Should Gemfile.lock be included in .gitignore?
A Gem's Gemfile.lock should NOT be in source control.
Setting up your GitHub Pages site locally with Jekyll
After reading the accepted answer of:
Assuming you're not writing a rubygem, Gemfile.lock should be in your repository. It's used as a snapshot of all your required gems and their dependencies. This way bundler doesn't have to recalculate all the gem dependencies each time you deploy, etc.
but I have no control over the Jekyll site. Please correct me if I'm understanding the process but Github Pages builds the site and if the Gemfile.lock is for development of Gems and that isn't something I can control it's ok to remove the file and add to the .gitignore?
GitHub Pages doesn't look for a Gemfile.lock file nor the Gemfile itself.
All it needs is a proper config file to load gems / plugins.
I just noticed that jekyll has all it needs installed locally, but a remote-theme is fetched every time jekyll is started.
I've also seen that people proposed a cache extension which hasn't been merged yet.
So I wonder if it is possible to just clone the remote theme to a certain folder?
ok, found the solution:
most themes are available also as ruby gems. So instead of specifying a remote-theme, I add the corresponding gem to Gemfile
gem "minimal-mistakes-jekyll"
and then reference it in the _config.yml
theme: minimal-mistakes-jekyll
I currently experienced an issue with Jekyll generators. Just implemented one regarding AMP. So I placed it inside the _plugins folder, and named it amp_generate.rb.
Tried to add some puts 'foo' but nothing on my terminal...
Giving a look at jekyll serve -V, it seems the generator never appears...
Any idea? Here is the source code : https://github.com/tiste/www
You're running in safe: true mode (like on github pages) because gem 'github-pages', group: :jekyll_plugins instruct jekyll to run in github pages context.
Simply change to gem 'github-pages'.
You can even simplify your Gemfile to be :
source 'https://rubygems.org'
ruby RUBY_VERSION
gem 'github-pages'
What are the main differences between the two gems jekyll and github-pages?
And why does GitHub recommend using github-page with Pages?
The github-pages gem will load all dependencies needed to run Jekyll exactly like on GitHub Pages.
jekyll gem is just Jekyll.
I have recently found excellent Octopress & Jekyll frameworks, and I am going
to switch my homepage to octopress from wordpress (which is rather well documented).
However, I am eager to add several plugins to octopress. For example, the one that
generates bibliographies. There are several plugins for Jekyll for doing this
(for example, https://github.com/inukshuk/jekyll-scholar)
However, I was not able to make it functional for an octopress website;
I tried to follow the install instructions, and instead of jekyll plugin directory
use the octopress plugin directory; it did not work out.
Can anyone provide me with general instructions how the jekyll plugin should be installed for a simple octopress blog (an example for jekyll-scholar would be enough).
Not 100% sure, as I'm new to Octopress and Jekyll myself but here goes:
Install
$ [sudo] gem install jekyll-scholar
Usage
Create a file called ext.rb in the plugins directory of Octopress.
The contents of the ext.rb file should be
require 'jekyll/scholar'
To adjust the Jekyll-Scholar settings, use the configuration file _config.yml