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

preserveAspectRatio #18

Closed
stephanedemotte opened this issue Aug 25, 2015 · 7 comments
Closed

preserveAspectRatio #18

stephanedemotte opened this issue Aug 25, 2015 · 7 comments

Comments

@stephanedemotte
Copy link

Hi,

Thanks for your great plugin !

Small question, how i can keep the preserveAspectRatio="none" attribute ?

I try with svgo :

removeAttrs: false,
removeUnknownsAndDefaults: false,

But i can't keep this value.

Any idea ?

@Hiswe
Copy link
Owner

Hiswe commented Aug 25, 2015

Right now no :(

You can try to play with my still (!!) unfinished branch: https://github.com/Hiswe/gulp-svg-symbols/tree/svgo-removal that doesn't use SVGO :)

It seems to have fixed some problems like in #6

@Hiswe
Copy link
Owner

Hiswe commented Sep 30, 2015

@stephanedemotte this plugin no longer use SVGO. Everything should be preserved!

@Hiswe Hiswe closed this as completed Sep 30, 2015
@stephanedemotte
Copy link
Author

great thanks !

@Hiswe
Copy link
Owner

Hiswe commented Oct 13, 2015

@stephanedemotte you're welcome :)

@am3000
Copy link

am3000 commented Apr 26, 2016

Hey, I also want to keep the preserveAspectRatio attribute of the original svg.
How can I achieve that?
Thanks!

@Hiswe
Copy link
Owner

Hiswe commented Apr 27, 2016

@am3000 it should be possible to do this with a custom templates with a custom transformdata function.

the svg params contains the originalAttributes. You should be able to access preserveAspectRatio from here.

@Hiswe Hiswe reopened this Apr 27, 2016
@Hiswe
Copy link
Owner

Hiswe commented May 5, 2016

@am3000 a template could look like that

<svg xmlns="http://www.w3.org/2000/svg" style="width:0; height:0; visibility:hidden;"><% if(defs) {%>
  <defs>
      <%= defs %>
  </defs><% } %><% _.forEach( icons, function( icon ){ %>
    <symbol id="<%= icon.id %>" viewBox="<%= icon.svg.viewBox %>"<% if (icon.svg.originalAttributes.preserveAspectRatio) {%> preserveAspectRatio="<%= icon.svg.originalAttributes.preserveAspectRatio %>" <% }%>><% if (icon.title) {%>
      <title><%= icon.title %></title><% }%>
      <%= icon.svg.content %>
    </symbol><%
}); %></svg>

But I think I will port it to the default template

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

No branches or pull requests

3 participants