Skip to content

Instantly share code, notes, and snippets.

@kswedberg
Created April 17, 2012 03:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kswedberg/2403117 to your computer and use it in GitHub Desktop.
Save kswedberg/2403117 to your computer and use it in GitHub Desktop.
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment