Skip to content

Instantly share code, notes, and snippets.

@awmichel
Created October 28, 2015 02:59
Show Gist options
  • Save awmichel/b98f9e05eaa0fbafc08b to your computer and use it in GitHub Desktop.
Save awmichel/b98f9e05eaa0fbafc08b to your computer and use it in GitHub Desktop.
Favicon Maker Rails Task
require 'favicon_maker'
def say(message)
puts message unless Rake.application.options.silent
end
namespace :favicon do
task :generate => :environment do
FaviconMaker.generate do
setup do
template_dir Rails.root.join(%w(app assets images))
output_dir Rails.public_path
end
from "favicon.png" do
icon "apple-touch-icon-76x76-precomposed.png"
icon "apple-touch-icon-72x72-precomposed.png"
icon "apple-touch-icon-60x60-precomposed.png"
icon "apple-touch-icon-57x57-precomposed.png"
icon "apple-touch-icon-precomposed.png", size: "57x57"
icon "apple-touch-icon.png", size: "57x57"
icon "favicon-32x32.png"
icon "favicon-16x16.png"
icon "favicon.png", size: "16x16"
icon "favicon.ico", size: "64x64,32x32,24x24,16x16"
end
each_icon do |filepath|
says "Generated favicon at: #{filepath}"
end
end
end
end
gem 'favicon_maker', '~> 1.3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment