Skip to content

Commit

Permalink
Upgrade Ruby to 3.3 and Jekyll to 4.3
Browse files Browse the repository at this point in the history
Jekyll comes with the jekyll-sass-converter plugin, so most of the work
in this commit is switching to that gem, which expects an _sass
directory by default. Also, that gem does not support sprockets, so we
need to do some manual handling of the various sass gems to include
their stylesheets and other assets (fonts) in the proper directories.

Fixes #878
  • Loading branch information
Fryguy committed Dec 13, 2024
1 parent d577568 commit b00bde9
Show file tree
Hide file tree
Showing 37 changed files with 45 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.3'
bundler-cache: true
timeout-minutes: 30
- name: Build
Expand Down
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
source 'https://rubygems.org'

ruby "~> 3.3.6"

gem "activesupport", ">= 5.2.7", :require => false
gem "bootstrap-sass", "~> 3.x"
gem "font-awesome-sass", "~> 4.x"
gem "jekyll", "~> 3.x"
gem "jekyll-assets", "< 3" # jekyll-assets 3.0.12 brings in sprockets 4 which has a bug: See https://github.com/envygeeks/jekyll-assets/pull/636
gem "jekyll", "~> 4.3"
gem "jekyll-coffeescript"
gem "jekyll-paginate"
gem "jekyll-sass-converter"
gem "jekyll-sitemap"
gem "jemoji"
gem "kramdown-parser-gfm"
Expand Down
2 changes: 1 addition & 1 deletion lib/miq/executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def run_cmd_with_bundle_env(cmd, clean)
success =
if clean || (cmd =~ /cd\ /)
env = ENV.to_h.slice("BUNDLE_WITHOUT", "MIQ_DEBUG", "MIQ_ENV")
Bundler.clean_system(env, cmd)
Bundler.unbundled_system(env, cmd)
else
system(cmd)
end
Expand Down
2 changes: 1 addition & 1 deletion site/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

plugins:
- jekyll-coffeescript
- jekyll-assets
- jekyll-paginate
- jekyll-sass-converter
- jekyll-sitemap
- jemoji

Expand Down
2 changes: 1 addition & 1 deletion site/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
</script>

{% css main %}
<link rel="stylesheet" href="/assets/css/main.css">
<link rel="canonical" href="{{ page.canonical_url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">

Expand Down
18 changes: 18 additions & 0 deletions site/_plugins/font_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require "font-awesome-sass"

class FontGenerator < Jekyll::Generator
def generate(site)
@site = site
@site.static_files.concat(font_files)
end

def font_files
source = FontAwesome::Sass.gem_path
Dir.glob(File.join(source, "assets/fonts/font-awesome/*")).map do |font|
font = font.sub(source, "")
dir = File.dirname(font)
file_name = File.basename(font)
Jekyll::StaticFile.new(@site, source, dir, file_name)
end
end
end
16 changes: 16 additions & 0 deletions site/_plugins/sass_loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require "jekyll/converters/scss"
require "bootstrap-sass"
require "font-awesome-sass"

# sass/load_paths configuration in _config.yml only supports hardcoded paths,
# so we override to add in the paths from the gems dynamically.
module SassLoader
def user_sass_load_paths
super + [
Bootstrap.stylesheets_path,
FontAwesome::Sass.stylesheets_path
]
end
end

Jekyll::Converters::Scss.prepend(SassLoader)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions site/_assets/css/main.scss → site/assets/css/main.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
---

@charset "utf-8";

$font-size-base: 16px;

@import "font-awesome-sprockets";
@import "bootstrap-sprockets";

@import "font-awesome";
@import "twbs_custom";
@import "twbs_overrides";
Expand Down

0 comments on commit b00bde9

Please sign in to comment.