svg-sprite / grunt-svg-sprite

SVG sprites & stacks galore — Grunt plugin wrapping around svg-sprite that reads in a bunch of SVG files, optimizes them and creates SVG sprites and CSS resources in various flavours

Home Page:https://github.com/svg-sprite/svg-sprite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong dimensions and color

tanmay1978 opened this issue · comments

An icon of dimension 40x40 when added to sprite it renders it as 50x50

Another issue is with the color. If I have a svg icon of white when that is added to the sprite it defaults to black. But that is beacause a class is added to all the svg elements and that class is overriden for other icons in the sprite. Is that a way to eliminate the use of css styles that it applies by default?

Hey @tanmay1978,

regarding the dimension issue, please post your complete configuration for the transformation.

Regarding the color: Please follow this thread for an explanation (and possible solution).

Cheers, Joschi

Hi the grunt config is as follow

// Make SVG sprite images from input svg icons
        svg_sprite : {
            your_target : {
                cwd         : paths.images.srcIcons,
                src         : '*.svg',
                dest        : paths.images.staticImages,
                options                 : {
                    shape               : {
                        spacing         : {
                            padding     : 5
                        }
                    },
                    mode                : {
                        view            : {
                            bust        : false,
                            render      : {
                                scss    : {
                                    dest    : '_sprite'
                                }
                            }
                        }
                    }
                }
            }
        },

So the dimension increase from 40 to 50 pixels is a logical result of your shape.spacing.padding = 5 option, as shape.spacing.box defaults to "content". Please see the documentation for all details about this.

Did you follow the other thread regarding the CSS issue.

As I don't see any error in svg-sprite's behavior here I'll close this issue for now. Please feel free to re-open it in case of any further real errors.

Cheers, Joschi

Thanks will check and confirm

I just checked if I use shape.spacing.box then the sprites are generated with no spacing between them and still the dimensions vary by 10px

What value did you set for shape.spacing.box?

it was set to "content"

[image: --]

Tanmay Arun Navghare
[image: https://]about.me/tanmayarunnavghare
https://about.me/tanmayarunnavghare?promo=email_sig

On Tue, Sep 8, 2015 at 12:52 AM, Joschi Kuphal notifications@github.com
wrote:

What value did you set for shape.spacing.box?


Reply to this email directly or view it on GitHub
#59 (comment)
.

So you didn't change anything? Then, of course, the behavior wouldn't change. Again, please read the relevant documentation section to understand the available options and how to use them. Thanks.