Skip to content

Instantly share code, notes, and snippets.

@thecocktail
Created September 4, 2008 18:40
Show Gist options
  • Save thecocktail/8841 to your computer and use it in GitHub Desktop.
Save thecocktail/8841 to your computer and use it in GitHub Desktop.
Nanoc plugin that flattens fireworks pngs
# Sips Flatten Filter for nanoc 2.1.1
#
# Uses the 'sips' command line tool in Mac OS X to flatten Fireworks images
# Quick hack, use at your own risk. Don't blame us if it destroys your carefully
# crafted images
module Nanoc::BinaryFilters
class SipsFlattenFilter < Nanoc::BinaryFilter
identifier :sips_flatten
def run(file)
# Get temporary file path
tmp_file = Tempfile.new("sips_filter")
flatten_format = @asset_rep.flatten_format || "png"
%x(sips -s format #{flatten_format} #{file.path} --out "#{tmp_file.path}">&/dev/null)
tmp_file
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment