skip svg #30

Closed
benatkin opened this Issue Jul 10, 2012 · 12 comments

Comments

Projects
None yet
Contributor

benatkin commented Jul 10, 2012

I got an email from someone who's using svg in img tags, saying that retina.js tried to swap those. I verified it and pushed up a small fix to my repo. I haven't added tests so I haven't sent a pull request yet.

cimm commented Jul 22, 2012

Noticed this as well, any chance to have a pull request (or a link to a patch)? Thanks!

Contributor

benatkin commented Jul 22, 2012

It isn't ready to merge yet, but I fixed it in the master branch of my fork. I'll try to get to it soon. In the meantime you can check https://github.com/benatkin/retinajs

Contributor

e1ven commented Nov 28, 2012

Did you ever get anywhere with this? ;)

bobrocke commented Feb 2, 2013

This would be a good fix to have. Can you push your changes, or should I switch to your fork?

Contributor

taylorsmith commented Sep 24, 2013

@benatkin - Any update on this? I'd be happy to merge if you've got it working.

I'd be interested in this as well. My workaround for now is to also serve the same identical .SVGs as "@2x" versions so they don't disappear once it doesn't find them.

Would be great to have this feature, to exclude SVG images.

Have you find a way to resolve this problem? Is the fix now pushed? Thank's.

You can add data-no-retina on any img tag for which you don't have (or need) a retina version (e.g., SVGs).

Any update on this? I can see no reason why SVGs would ever be swapped.

Contributor

taylorsmith commented Jul 31, 2014

As @adamjspooner mentioned, you can add data-no-retina to any image you'd like to skip. I agree that there's not a likely use case for swapping SVGs, but we'd prefer to leave that decision up to the end user.

Hello,

A quick solution is to replace the suffixReplace method (if you don't want to add the data-no-retina tag) :

function suffixReplace (match) {
    if(match==".svg"){
        return match;
    }else{
        return config.retinaImageSuffix + match;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment