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

Adding custom attributes to rootAttributes #87

Closed
iMoses opened this issue Jun 1, 2015 · 5 comments
Closed

Adding custom attributes to rootAttributes #87

iMoses opened this issue Jun 1, 2015 · 5 comments

Comments

@iMoses
Copy link

iMoses commented Jun 1, 2015

Is it possible? Unless I missed something it doesn't seem to be extendable.
I think it's an important and easy enough feature/option to add.

If there's a way I'd like to hear about it and if not then consider this as a feature request.

@jkphl
Copy link
Collaborator

jkphl commented Jun 1, 2015

Hi @iMoses,

thanks for the suggestion. In general I agree, although I think it shouldn't be svg-sprite's job to do these kind of SVG modifications. For a lot of users the available configuration options are already overwhelming enough. ;)

However, I already considered adding a global post-transformation on the final sprite, which would totally suit your need. Due to my current workload this will take me some time to implement though. Thanks for your patience.

Cheers,
Joschi

@iMoses
Copy link
Author

iMoses commented Jun 1, 2015

Are you expecting code contributions?
This library is the only one who suits my needs other than this little issue.
I really need to add to the root element the preserveAspectRatio="none" attribute.
I have no problem implementing the option and I would prefer it would be a part of the official library and not some fork of mine.

@jkphl
Copy link
Collaborator

jkphl commented Jun 2, 2015

I fully agree that splitting of a fork just because of this one wouldn't make much sense. However, I also don't think svg-sprite should have extra options for each and every special case, so using a generic post-transformation for this (and other) modifications seems right to me. I'll put this high on my schedule, ok?

@iMoses
Copy link
Author

iMoses commented Jun 2, 2015

Okay, thanks.

P.S. I agree, the best solution in this case should be generic, not specific.

@jkphl
Copy link
Collaborator

jkphl commented Jun 4, 2015

As of release v1.2.0 there are now two options to add custom root attributes:

  1. You may use the new svg.rootAttributes option to do just that ;) (decided to introduce this as an easy shorthand for the next one)
  2. Additionally you can now specify global post-processing transformation callbacks via svg.transform which get called with the full SVG source ...

I'm pretty sure you can now achieve what you wanted to, right?

Cheers,
Joschi

@jkphl jkphl closed this as completed Jun 4, 2015
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

2 participants