Github io Blog를 Ubuntu local에서 빌드 및 확인

번거로운 commit 및 deployment 대기 시간을 없애기 위해,,,

2024-01-06

서론:


본론 전 미리 스포

본론

1. rubygem 설치 및 설정

ruby -v
> ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

gem -v
> 3.1.2
sudo apt-get install ruby-full build-essential zlib1g-dev
# 주의, 최초 1회만 실행하면 됨. 계속 하면 bashrc 더러워짐
echo "export GEM_HOME=$HOME/gems" >> ~/.bashrc
echo "export PATH=$HOME/gems/bin:$PATH" >> ~/.bashrc
source ~/.bashrc


2. bundlerjekyll 설치

gem install jekyll bundler # 설치

# 에러들
ERROR:  Error installing jekyll:
	The last version of sass-embedded (~> 1.54) to support your Ruby & RubyGems was 1.63.6. Try installing it with `gem install sass-embedded -v 1.63.6` and then running the current command again
	sass-embedded requires Ruby version >= 3.1.3. The current ruby version is 2.7.0.0.
Fetching bundler-2.5.4.gem
ERROR:  Error installing bundler:
	The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.4.22. Try installing it with `gem install bundler -v 2.4.22`
	bundler requires Ruby version >= 3.0.0. The current ruby version is 2.7.0.0.
gem install sass-embedded -v 1.54
gem install bundler -v 2.4.22
# 주소 주의, 내 블로그에용
git clone git@github.com:engcang/engcang.github.io
cd engcang.github.io
bundle init
plugins:
  - jekyll-sitemap
  - jekyll-seo-tag
  - jemoji
  - jekyll-remote-theme
# frozen_string_literal: true

source "https://rubygems.org"

# gem "rails"
gem "jekyll-sitemap"
gem "jekyll-seo-tag"
gem "jemoji"
gem "jekyll-remote-theme"
gem "kramdown-parser-gfm"
bundle install


3. bundlerjekyll 실행 및 내 블로그 빌드해서 로컬에서 보기

bundler exec jekyll serve
> Server address: http://127.0.0.1:4000
> Server running... press ctrl-c to stop.
...

Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2023-02-27-docker.md':
                    uninitialized constant Kramdown::Utils::OrderedHash
...

14: from /home/mason/gems/gems/jekyll-4.3.3/lib/jekyll/converters/markdown/kramdown_parser.rb:54:in `initialize'
13: from /usr/lib/ruby/vendor_ruby/kramdown/parser/base.rb:69:in `parse'

...
sudo apt remove ruby-kramdown
bundler exec jekyll serve