Only require (chunky|oily)_png if it is needed.
This commit is contained in:
parent
43fa6cf93b
commit
00b41b5506
@ -1,5 +1,3 @@
|
|||||||
require 'chunky_png'
|
|
||||||
|
|
||||||
module Compass::SassExtensions::Functions::Sprites
|
module Compass::SassExtensions::Functions::Sprites
|
||||||
ZERO = Sass::Script::Number::new(0)
|
ZERO = Sass::Script::Number::new(0)
|
||||||
|
|
||||||
@ -121,8 +119,17 @@ module Compass::SassExtensions::Functions::Sprites
|
|||||||
!File.exists?(filename) || outdated?
|
!File.exists?(filename) || outdated?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def require_png_library!
|
||||||
|
begin
|
||||||
|
require 'oily_png'
|
||||||
|
rescue LoadError
|
||||||
|
require 'chunky_png'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Returns a PNG object
|
# Returns a PNG object
|
||||||
def construct_sprite
|
def construct_sprite
|
||||||
|
require_png_library!
|
||||||
output_png = ChunkyPNG::Image.new(width, height, ChunkyPNG::Color::TRANSPARENT)
|
output_png = ChunkyPNG::Image.new(width, height, ChunkyPNG::Color::TRANSPARENT)
|
||||||
images.each do |image|
|
images.each do |image|
|
||||||
input_png = ChunkyPNG::Image.from_file(image[:file])
|
input_png = ChunkyPNG::Image.from_file(image[:file])
|
||||||
|
Loading…
Reference in New Issue
Block a user