Jekyll is written in Ruby. If you’re new to Ruby, this page helps you learn some of the terminology.
Jekyll是用Ruby寫的。如果您是Ruby新手,此頁面可以幫助您學習一些術語。
Gems是可以包含在Ruby專案中的程式碼。Gems封裝(套裝)特定功能。您可以跨多個專案或與其他人共用gem。可以執行以下操作:
Jekyll是一顆gem。許多Jekyll插件 也是gems,包括 jekyll-feed、jekyll-seo-tag 與jekyll-archives。
Gemfile是您的網站所使用的gem清單。每個Jekyll網站的主資料夾中都要有一個Gemfile。
對於一個單純的Jekyll站點,Gemfile可能看起來像這樣:
source "https://rubygems.org"
gem "jekyll"
group :jekyll_plugins do
gem "jekyll-feed"
gem "jekyll-seo-tag"
end
Bundler是一個gem,它會安裝Gemfile中的所有gem。
雖然您不一定要使用Gemfile和bundler,但強烈建議您使用,因為Gemfile可以確保您在不同環境中運行相同版本的Jekyll及其外掛程式。
使用 gem install bundler 安裝 Bundler。您只需要安裝一次,而不是每次新增一個新的Jekyll專案時都安裝它。
若要使用 Bundler 在 Gemfile 中安裝 gem,請在包含 Gemfile 的目錄中執行下列命令:
bundle install
bundle exec jekyll serve
如果您不使用Gemfile,請繞過Bundler,請執行 jekyll serve。
有關Jekyll中Bundler的更多資訊以及快速啟動和運行的說明,請參閱Using Jekyll with Bundler。
Gems are code you can include in Ruby projects. Gems package specific functionality. You can share gems across multiple projects or with other people. Gems can perform actions like:
Jekyll is a gem. Many Jekyll plugins are also gems, including jekyll-feed, jekyll-seo-tag and jekyll-archives.
A Gemfile is a list of gems used by your site. Every Jekyll site has a Gemfile in the main folder.
For a simple Jekyll site it might look something like this:
source "https://rubygems.org"
gem "jekyll"
group :jekyll_plugins do
gem "jekyll-feed"
gem "jekyll-seo-tag"
end
Bundler is a gem that installs all gems in your Gemfile.
While you don’t have to use Gemfile and bundler, it is highly recommended as it ensures you’re running the same version of Jekyll and its plugins across different environments.
Install Bundler using gem install bundler. You only need to install it once, not every time you create a new Jekyll project.
To install gems in your Gemfile using Bundler, run the following in the directory that has the Gemfile:
bundle install
bundle exec jekyll serve
To bypass Bundler if you aren’t using a Gemfile, run jekyll serve.
See Using Jekyll with Bundler for more information about Bundler in Jekyll and for instructions to get up and running quickly.