LoginSignup
2
3

More than 5 years have passed since last update.

jekyllでslimを使う

Posted at

rubyでできた、ブログ、静的ページ生成ツールjekyll(ジキル)でテンプレートエンジンslimを使う方法。

jekyll-slimのインストール

gem 'jekyll-slim' 

bundle install

プラグインの読み込み

rootディレクトリに_plugins/bundler.rbを作成し、内容を以下のようにする。

bundler.rb
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)

htmlファイルをslimに置き換える

_layouts/default.html等を.slimにリネームし、マークアップをslim形式に変更する。

参考: Slim - A Fast, Lightweight Template Engine for Ruby

テンプレートを読み込む

_includesディレクトリにあるテンプレートを読み込みたい場合は通常のincludeの部分をslimに置き換えます

#footer
  | {% slim footer.slim %}

hamlでやる場合もだいたい同じ。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3