Created
April 17, 2012 03:10
-
-
Save kswedberg/2403117 to your computer and use it in GitHub Desktop.
Revisions
-
kswedberg created this gist
Apr 17, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ # General output_style = :expanded relative_assets = true line_comments = false project_path = File.dirname(__FILE__) + "/" utils_dir = project_path + "utils/" # Sass Paths http_path = "/" http_javascripts_path = http_path + "assets/js/" http_stylesheets_path = http_path + "assets/css/" http_images_path = http_stylesheets_path + "img/" http_fonts_path = http_stylesheets_path + "fonts/" # Sass Directories (relative to this config.rb file) javascripts_dir = "../assets/js/" css_dir = "../assets/css/" sass_dir = css_dir + "src/" images_dir = css_dir + "img/" # Quantize 8-bit sprites on_sprite_saved do |file| if !is_32bit?(file) && ENV["QUANTIZE_IMG"] == "y" quantize(file, utils_dir + "pngquant/pngquant-mac") end if ENV["OPTIMIZE_IMG"] == "y" optimize(file, utils_dir + "pngout/pngout-mac") end end # Methods def is_32bit?(file) File.basename(file).match(/^png(24|32)/) end def quantize(file, binary) png8_file = file.sub(/\.png/, "-fs8.png") system binary + " " + file sleep 2 system "mv -f " + png8_file + " " + file growl("Sprite: " + File.basename(file) + " quantized") end def optimize(file, binary) system binary + " " + file + " -y" growl("Sprite: " + File.basename(file) + " optimized") end