drdk / grunt-dr-svg-sprites

Grunt plugin to create SVG sprites with PNG fallbacks at needed sizes
113 stars 19 forks source link

refSize working as expected 0.2.7 #4

Closed benfrain closed 10 years ago

benfrain commented 10 years ago

Not sure if I'm doing this wrong. Trying out 0.2.7 and here is my config:

"svg-sprites": {
            options: {
                prefix: "sausages",
                paths: {
                    spriteElements: "source/img/svg/sprites",
                    sprites: "source/img/svg/sprites",
                    css: "source/css/sprites"
                },
                sizes: {
                    large: 30
                },
                refSize: 20,
                unit: 8
            }
        }

I was hoping for refSize to mean that the resultant SVG (and associated CSS rules) would have a height of "20" and a width proportional to that - it doesn't. Should it?

phloe commented 10 years ago

What are the dimesnsions of your source SVG elements?

benfrain commented 10 years ago

They are 960px by 560px (hence the wish to resize) :+1:

Here is the SVG info:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="960px"
     height="560px" viewBox="0 0 960 560" enable-background="new 0 0 960 560" xml:space="preserve">
phloe commented 10 years ago

Ok - there would be no need to "scale" the actual svg data; it's vector format after all.

refSize would be the basic height of your source files (some might be taller - some lower); in your case - 560.