chriseppstein/compass — Issue #686: SVG image dimensions
Author: seamusleahy
Created: 2012-01-25 16:36:48+00:00
State: open

The replace-text-with-dimensions() function doesn't work for SVGs because the image dimension function don't support SVG.

I was able to get it to work for my use case by adding a get_size_for_svg method to the ImageProperties class in Compass::SassExtensions::Functions::ImageSize.

def get_size_for_svg
require 'rexml/document'
svg = File.read(@file)
doc = REXML::Document.new(svg)
[doc.root.attributes['width'].to_i, doc.root.attributes['height'].to_i]
end

I am reading the width and height attributes from the root