From db74d8bdb36de7a778ed2ecbfb194fbddf6ab508 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Sun, 12 Jun 2011 13:36:49 -0400 Subject: [PATCH 1/3] new config option to pass options along to chunky_png --- lib/compass/configuration.rb | 3 ++- lib/compass/configuration/defaults.rb | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index 2990e85d..d8efb812 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -38,7 +38,8 @@ module Compass :color_output, :preferred_syntax, :disable_warnings, - :sprite_engine + :sprite_engine, + :chunky_png_options ].flatten # Registers a new configuration property. diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index 7c9add32..236ce672 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -133,6 +133,10 @@ module Compass :chunky_png end + def default_chunky_png_options + {:compression => Zlib::BEST_COMPRESSION} + end + # helper functions def http_join(*segments) From dc504ecd8ee3dd5008c2aefb23262da2b2875ce7 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Sun, 12 Jun 2011 13:37:20 -0400 Subject: [PATCH 2/3] pass new config options to chunky_png canvas on image save --- .../sass_extensions/sprites/engines/chunky_png_engine.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb b/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb index c26caa11..99bca823 100644 --- a/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +++ b/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb @@ -33,10 +33,11 @@ module Compass if canvas.nil? construct_sprite end - canvas.save(filename, :best_compression) + + canvas.save(filename, Compass.configuration.chunky_png_options) end end end end -end \ No newline at end of file +end \ No newline at end of file From 84f7b7a5efeb0329b5bc97c9c7a4ed6359af5c29 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Sun, 12 Jun 2011 15:16:20 -0400 Subject: [PATCH 3/3] added docs for chunky_png_options config --- .../help/tutorials/configuration-reference.markdown | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc-src/content/help/tutorials/configuration-reference.markdown b/doc-src/content/help/tutorials/configuration-reference.markdown index 642707ca..02682243 100644 --- a/doc-src/content/help/tutorials/configuration-reference.markdown +++ b/doc-src/content/help/tutorials/configuration-reference.markdown @@ -280,6 +280,13 @@ later on. Symbol Defaults to :chunky_png + + chunky_png_options + Hash + + Defaults to {:compression => Zlib::BEST_COMPRESSION}. See the chunky_png wiki for more information + +