Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefixize fails for defs styles using fill: url(#name) #27

Closed
andest01 opened this issue Mar 13, 2016 · 3 comments
Closed

prefixize fails for defs styles using fill: url(#name) #27

andest01 opened this issue Mar 13, 2016 · 3 comments

Comments

@andest01
Copy link

I am running svg-sprite-loader@0.0.17.

prefixize.js seeks to adjust names of styles that use url(#myNameHere) to the appropriate generated ID. However, this fails for one of our use cases that has a linearGradient in a SVG def attribute.

Here is an example SVG image on codepen: http://codepen.io/troutr/pen/VaKMMR
Note the style named .simpleClass uses a fill to #simpleGradient.

<defs>
    <style>
    .simpleClass {
        fill: url(#simpleGradient);  /*This should get updated to a new name...??*/
    }

    .company-fill {
        fill: #18a7e0;
    }
    </style>
    <linearGradient id="simpleGradient" x1="5709.17" y1="20.01" x2="5724.1" y2="34.94" gradientUnits="userSpaceOnUse">
        <stop offset="0" stop-color="#003952" />
        ...etc etc
        <stop offset="0.99" stop-color="#003952" />
    </linearGradient>
</defs>

Note the gradient fill on the bottom half of the SVG image.
Result image with gradient

Running this SVG through prefixize: true produces the following results:

<defs>
    <style>
    .simpleClass {
        fill: url(#simpleGradient);  /* NOT UPGRADED! */
    }

    .company-fill {
        fill: #18a7e0;
    }
    </style>
    <linearGradient id="CompanyIcon_778e02c09f8a5ed0e12a9f654379ecbe_simpleGradient" x1="5709.17" y1="20.01" x2="5724.1" y2="34.94" gradientUnits="userSpaceOnUse">
        <stop offset="0" stop-color="#003952"></stop>
        ...etc etc
        <stop offset="0.99" stop-color="#003952"></stop>
    </linearGradient>
</defs>

This results in the following image:
Result image without gradient
I noticed that fill: url(#simpleGradient); is not updated to fill: url(#CompanyIcon_778e02c09f8a5ed0e12a9f654379ecbe_simpleGradient);.

@princed
Copy link
Contributor

princed commented Mar 14, 2016

Yes, unfortunately we do not support css (even inline) yet.

@gazpachu
Copy link

I have the same problem

@kisenka
Copy link
Contributor

kisenka commented Oct 14, 2016

Shipped with 0.0.31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants