Compass / Sass check if file exists
I'm using compass to generate sprites and a have a mixin that calculates the width and height of the original asset and adds that into the css. I also have an option on this mixin to pass in true or false for hover state images. But rather than having to specify this each time I use the mixin I'd like to add the hover css by default if the file exists. I've added the following to my config.rb file (thus far its the only extension I have) module Sass::Script::Functions def file_exists(image_file) path = image_file.value Sass::Script::Bool.new(File.exists?(path)) end end And my mixin looks like