Created
February 1, 2015 22:29
-
-
Save Jamedjo/4ea6eae108fb3f34d1ed to your computer and use it in GitHub Desktop.
Resize images and move from ./originals to ./
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :sprites do | |
originals = Rake::FileList.new('app/assets/images/**/originals/*.png') | |
resized = originals.pathmap("%{/originals$,/}d%f") | |
task resize: resized | |
end | |
from_originals = ->(tn) { | |
tn.pathmap("%d/originals/%f") | |
} | |
rule(/^((?!originals).)*.png$/ => [from_originals]) do |t| | |
original = t.prerequisites[0] | |
width = 80 | |
sh "convert #{original} -resize #{width}x #{t.name}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment