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

Corrupted sprites

patolo opened this issue · comments

Some of my sprites gets corrupted, not all, any suggestions on what to do?
'female-standing-normal': {
src: ['src/templates/assets/sprites/female-standing-normal'],
dest: '<%= site.destination %>/assets/sprites/female-standing-normal',
options: {
render: {
css: false,
scss: {
dest: 'sass/_sprite/female-standing-normal'
}
},
layout: 'horizontal'
}
}

hi @patolo,

could you please provide more info? What do you mean with "corrupted"? Are they generated at all? Are graphical parts missing? What exactly is wrong about the sprites? Could you please provide the original SVG files? On which platform are your? ...

Cheers,
Joschi

Hi Joschi, here are my pics and sprite
/@patolo

On Mon, Jul 14, 2014 at 9:12 AM, Joschi Kuphal notifications@github.com
wrote:

hi @patolo https://github.com/patolo,

could you please provide more info? What do you mean with "corrupted"? Are
they generated at all? Are graphical parts missing? What exactly is wrong
about the sprites? Could you please provide the original SVG files? On
which platform are your? ...

Cheers,
Joschi


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

Vänliga hälsningar,

Patrik Olofsson

mobile: +46 73-513 66 37

tretton37

Klostergatan 2

222 22 Lund

Sweden

tretton37.com http://tretton37.com/

I'm on ubuntu 12.04

I experience problems with corrupted sprites as well on Ubuntu 12.04

sprite-example

Example image attached

hey guys,

thanks for your feedback, but both of you didn't really include the original SVG files, so I can't test myself (@patolo: Where should that link point to? It just takes me to your GitHub profile ...).

Have you tried playing with the SVGO optimizer options? Respectively have you already tried to disable SVG optimization altogether (via cleanwith: null)? SVGO with all plugins enabled tends to be somewhat aggressive and sometimes cripples certain SVG files. You should try disabling SVGO and see if your sprites still get corrupted. If not, then try to disable single SVGO plugins like so:

/* ... */
cleanconfig: {
    plugins: {
        {cleanupAttrs: false}
    }
}
/* ... */

For a list of all the active plugins please see the source code. Finally, you could also try to "fix" your SVG files (no idea if that's a valid suggestion at all and whether it is possible in your certain cases). Hope this helps.

Cheers,
Joschi

jkphl, thanks for your reply. FYI leaving cleanwith: NULL results in no sprite being generated at all. However this config change seems to have fixed my issue:

            cleanconfig: {
                plugins: [
                    {convertPathData: false}
                ]
            }

Hey @tolvstein,

great! Yeah, that's what I meant when I said that SVGO is too aggressive sometimes (with certain SVGs). It's more a problem of SVGO than of svg-sprite ...

However, setting cleanwith: null should work — I'll check that, must be an error.

Thanks & cheers,
Joschi

Hi @patolo & @tolvstein,

I just published the next major release of grunt-svg-sprite. It's rewritten from scratch and I'm pretty confident that disabling SVGO optimization altogether doesn't make any problems anymore — could you please check this? Still, configuring the SVGO plugins appropriately will be of importance, though ...

I'll close the issue for now, but please feel free to re-open it in case you've still got problems.

Cheers & a happy new year,
Joschi