[Middleman 3] middleman-favicon-maker で favicon, icon image を生成する

Favicon maker という gem をつかって、色々なサイズの icon 類を作成します。

“`prettyprinted
% middleman version
Middleman 3.3.6
“`

こちらで紹介されていました。

> [Understanding Middleman – the static site generator for faster prototyping – Author and responsive web developer Ben Frain](http://benfrain.com/understanding-middleman-the-static-site-generator-for-faster-prototyping/)

## インストール

> [follmann/middleman-favicon-maker](https://github.com/follmann/middleman-favicon-maker)

imagemagick をインストールします。

“`prettyprinted
% brew install imagemagick
“`

“`ruby:Gemfile
gem ‘middleman-favicon-maker’, ‘~> 3.7’
“`

Bundle インストールします。

“`prettyprinted
% bundle install –path vendor/bundle
“`

## つかいかた

`source/_favicon_template.png` に元になるファイルを設置します。
さらに config.rb に必要なサイズとフォーマットを設定として書き加えます。

“`ruby:config.rb
configure :build do
activate :favicon_maker, :icons => {
“_favicon_template.png” => [
{ icon: “apple-touch-icon-precomposed.png”, size: “152×152” },
{ icon: “favicon.png”, size: “96×96” },
{ icon: “favicon.ico”, size: “32×32” },
{ icon: “tileicon.png”, size: “144×144” },
]
}
“`

/build に画像が生成されました。