Created
June 14, 2012 21:15
-
-
Save averyvery/2932996 to your computer and use it in GitHub Desktop.
Minifying JS, shrinking retina images down
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
guard 'compass' do | |
watch /^.+(\.s[ac]ss)/ | |
end | |
guard 'process', :name => 'minify-screen-js', :command => 'juicer merge js/all.js -o js/all.min.js --force -s' do | |
watch /^js\/brianregan\/screen.js/ | |
end | |
guard 'process', :name => 'minify-mobile-js', :command => 'juicer merge js/mobile.js -o js/mobile.min.js --force -s' do | |
watch /^js\/brianregan\/mobile.js/ | |
end | |
guard 'process', :name => 'shrink-images', :command => 'ruby resize-mobile-images.rb mobileretina' do | |
watch /^images\/mobileretina\/.+/ | |
end |
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
require 'rmagick' | |
source = ARGV[0] | |
Dir.glob('images/' + source + '/*.*').each do |image_path| | |
GC.start | |
image = Magick::Image::read(image_path).first | |
image.resize!(image.columns / 2, image.rows / 2, Magick::GaussianFilter, 0.2) | |
new_path = image_path.sub(/retina/, 'normal') | |
image.write new_path | |
image.destroy! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment