Versions
Windows 10.0.19044.2364
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt]
gem v3.3.26
jekyll 4.3.1
Problem
With my Gemfile and _config.yml in a default configuration using the minima theme, everything works as expected. When I attempt to change to another theme (any theme), the site fails to load propertly.
Details
My default Gemfile:
source "https://rubygems.org"
# gem "jekyll", "~> 4.3.1"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima"
gem "github-pages", "~> 227", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
gem "jekyll-remote-theme"
end
...
My default _config.yml:
title: default theme...
email: email#example.com
description: ...description...
domain: "chrisxfire.github.io"
url: "http://chrisxfire.github.io"
# Build settings
theme: minima
# remote-theme: pages-themes/midnight#v0.2.0
plugins:
- jekyll-feed
- jekyll-remote-theme
GitHub Pages generates the site correctly and the page is normal:
Next, I attempt to use a GitHub Pages-supported theme, like midnight. I make the following changes:
In Gemfile, I change the line gem "minima" to:
gem "jekyll-theme-midnight"
In _config.yml, I change the line theme: minima to:
theme: jekyll-theme-midnight
I then commit. GitHub Actions finish successfully, but I now have a blank white page on the site.
Next, per the instructions on the midnight theme's GitHub site, I try making the following changes to _config.yml:
# theme: jekyll-theme-midnight
remote-theme: pages-themes/midnight#v0.2.0
I then commit. GitHub Actions finish successfully. However, the page renders with only a blue header and nothing else:
What am I doing wrong?
testing midnight theme... is your theme title.
To show the page in midnight black, I have moved your github-pages gem into plugins in the Gemfile:
source "https://rubygems.org"
group :jekyll_plugins do
gem "github-pages"
gem "jekyll-feed", "~> 0.12"
gem "jekyll-remote-theme"
end
Also, the current post and home layouts in pages and posts create warnings when starting the server. You should see them in the build log.
The theme is not required in your Gemfile anymore, as you use the remote-theme options in your _config.yml.
Related
Description
I'm trying to setup my personal website using GitHub Pages with Jekyll 3.8.5 as described in https://help.github.com/en/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll, but having an issue with the bundler.
Details
Bundle can't find the installed Jekyll 3.8.5
$ bundle exec jekyll 3.8.5 new .
fatal: 'jekyll 3.8.5' could not be found. You may need to install the jekyll-3.8.5 gem or a related gem to be able to use this subcommand.`
Verifying that I actually have jekyll-3.8.5
$ bundle info jekyll
* jekyll (3.8.5)
Summary: A simple, blog aware, static site generator.
Homepage: https://github.com/jekyll/jekyll
Path: /Users/macikportali/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/jekyll-3.8.5
Gemfile (installed with bundle install)
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 4.0.0"
# gem "jekyll", "~> 3.8.5"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
gem "jekyll-athena"
# Seems this is needed to install a lot of subcommands, see: https://github.com/jekyll/jekyll-compose
gem 'jekyll-compose', group: [:jekyll_plugins]
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# for jekyll 3.8.5
gem "github-pages", "204", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.11"
end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
gem "tzinfo", "~> 1.2"
gem "tzinfo-data"
end
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
Jekyll is used with shims
$ which jekyll
/Users/macikportali/.rbenv/shims/jekyll
My current rbenv version
$ rbenv version
2.7.1 (set by /Users/macikportali/.rbenv/version)
Question
Why bundler cannot see the installed jekyll-3.8.5 gem?
Okey, I think I figured it out. I have two different versions for Jekyll.
$ gem list jekyll
*** LOCAL GEMS ***
jekyll (4.0.1, 3.8.5)
What I did was to add underscores(_) as prefix and postfix to the version, thus, executed
bundle exec jekyll _3.8.5_ new docs
That fixed the problem because I believe this is the convention that gem follows when you have different versions.
Now, I have a different problem which is having 404 page but that's another issue to deal with.
I was following the github instructions for jekyll and github. At step 8 & 9 it says:
8) Open the Gemfile that was created and follow the instructions in the
Gemfile's comments to use GitHub Pages.
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", group: :jekyll_plugins
9) Update the gem "github-pages" line so that the line looks like this, replacing VERSION with the current dependency version for
github-pages. For more information, see "Dependency versions" on the
GitHub Pages site.
gem "github-pages", "~> VERSION", group: :jekyll_plugins
but I don't understand what goes in VERSION
I tried the following:
# gem "github-pages", "~> jekyll 3.8.5", group: :jekyll_plugins
#gem "github-pages", "~> 3.8.5", group: :jekyll_plugins
but they all result in errors. However, its obvious that the errors don't matter because I don't know what is suppose to go in Version. Whats supposed to go in version VERSION?
related error:
https://talk.jekyllrb.com/t/how-to-install-github-pages-with-jekyll/3510
The versions for the github-pages gem are different than for the Jekyll gem.
To look up a gem's versions, use RubyGems.org.
Here are the versions for github-pages: https://rubygems.org/gems/github-pages
The latest version is 202, so you'd put:
gem "github-pages", "202"
With each new release (you can watch the github/pages-gem repo for releases if you want to be notified when new ones are released), just replace the "202" with the new version in quotes.
Hope this helps.
I have a Jekyll site which was running perfectly few days back. Today when I ran jekyll serve it has started throwing error.
Dependency Error: Yikes! It looks like you don't have jekyll-sitemap or one of its dependencies installed.
I have jekyll-sitemap installed
gem query | grep jekyll-sitemap
jekyll-sitemap (0.10.0)
If I remove jekyll-sitemap from _config.yml and run jekyll serve then it thrown an error for kramdown is not installed, which is also installed.
Searching around the net have solutions like they have multiple versions of kramdown or jekyll installed but I don't have any such issues.
Here is my _config.yml
# Site settings
title: Malabya Tewari
header-img: img/home-bg.jpg
email: imalabya#gmail.com
copyright_name: Malabya Tewari
description: "Drupal developer, Open source enthusiast, trainer, blogger from Bangalore."
keywords: "Malabya Tewari, malavya, Drupal, Drupal Developer"
baseurl: ""
url: "http://imalabya.github.io"
twitter_username: malabya88
drupal_username: malavya
facebook_username: malabya88
linkedin_username: https://www.linkedin.com/in/malabyatewari
# Build settings
markdown: kramdown
highlighter: rouge
permalink: pretty
paginate: 10
exclude: ["less","node_modules","Gruntfile.js","package.json","README.md"]
gems: [jekyll-paginate, jekyll-feed, jekyll-sitemap]
Any help will be appreciated as I am very new or Jekyll or ruby.
I took your code at https://github.com/imalabya/imalabya.github.io
Edited Gemfile to :
source 'https://rubygems.org'
gem "jekyll"
gem "jekyll-sitemap"
gem "jekyll-paginate"
gem "jekyll-feed"
Ran a bundle update, and then a bundle exec jekyll serve.
Everything is ok.
In Rails 3, gems used exclusively to generate assets in the asset pipeline were properly placed in the assets group of the Gemfile:
...
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
end
Now, according to the (still in progress) upgrade documentation:
Rails 4.0 removed the assets group from Gemfile. You'd need to remove that line from your Gemfile when upgrading.
Sure enough, making a new project with RC1 yields a Gemfile with asset-related gems included by default outside of any group:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0.rc1'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
...
Does this mean these gems will now be bundled in production builds by default? If so, why the change of heart? Is Rails 4 moving towards the dynamic generation of assets in production?
Previously the assets group existed to avoid unintended compilation-on-demand in production. As Rails 4 doesn't behave like that anymore, it made sense to remove the asset group.
This is explained in more detail in the commit that changed that. I extracted some quotes with the actual answer.
Some gems can be needed (in production) like coffee-rails if you are using coffee templates
and the fact that now assets are not precompiled on demand in production anymore.
(not precompiled on demand in production) Means that if you have that gems in production environment in 3.2.x and forget to precompile, Rails will do exactly what it does in development, precompile the assets that was requested. This is not true anymore in Rails 4, so if you don't precompile the assets using the tasks you will get a 404 when the assets are requests.
Rails 4 try to force you to precompile your assets before deployment. You have to precompile your assets with
$ RAILS_ENV=production bundle exec rake assets:precompile
And why?
I found this in Guide:
By default Rails assumes that assets have been precompiled and will be
served as static assets by your web server.
(Source: http://edgeguides.rubyonrails.org/asset_pipeline.html#in-production)
But many time you have to use these 'assets' gems in production... for example, if you use a js.coffee file in your views directory, then Rails needs coffee compiler in production mode as well.
So I guess, the reason of this change is performance improvement... and looks more simple as well. :)
We want coffeescript with AJAX (history), so coffee-rails moves out of the assets group.
sass-rails misbehaves (history), so it moves out of the assets group.
Axe the assets group.
I just updated from 3.0.8 to rails 3.1 rc1. However,the css in my site is clearly not being accessed beacuse my site has no design anymore. I though i could fix it by creating an assets folder and placing my stylesheets and js inside the app/assets folder but that hasn't worked.
I also commented this line out in my config/environments/development.rb file
#config.action_view.debug_rjs = true
and I added this file to my config/application.rb file
config.assets.enabled = true
Here is what my gemfile looks like:
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc1'
gem 'devise'
gem 'jquery-rails'
gem 'omniauth'
gem 'rails3-generators'
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
gem 'sass-rails'
group :development do
gem 'sqlite3-ruby'
end
What am I doing wrong?
P.S. my images are also not showing up
Your app/assets directory should look like this:
app/
assets/
images/
pancakes.png
...
javascripts/
application.js
...
stylesheets/
application.css
...
There is a guide to the new asset pipeline. You might have to fix some paths as well.