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

Feature request: add 'class' parameter to svg() #3174

Closed
frankharrison-wj opened this issue Jul 31, 2018 · 11 comments

Comments

Projects
None yet
3 participants
@frankharrison-wj
Copy link

commented Jul 31, 2018

Would be great for the svg() function to allow a second 'class' parameter which would inject that class name into the SVG before inlining it. I built my own plugin to do this but would be nice to have out-of-the-box!

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jul 31, 2018

Not sure I’m following. You mean so it ends up like this?

<svg class="<TheClassName>" ... />
@frankharrison-wj

This comment has been minimized.

Copy link
Author

commented Jul 31, 2018

Yep – can also be done with a find and replace on the text, but would be nice to have it as part of the svg() function if possible.

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jul 31, 2018

I’m not really interested in making the svg() function more complicated than it needs to be. You could just wrap the SVG in a <div> with the class name instead.

@frankharrison-wj

This comment has been minimized.

Copy link
Author

commented Jul 31, 2018

Fair enough – I'll stick to my plugin!

@benface

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2018

@frankharrison-wj Have you released this plugin somewhere by any chance? :)

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Nov 28, 2018

I’ve actually seen the light on why a class attribute would be super helpful, so reopening this and will see if we can get it into 3.1 before it goes out of beta.

@brandonkelly brandonkelly reopened this Nov 28, 2018

@benface

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2018

@brandonkelly Great! Have you been using functional CSS by any chance? ;)

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Nov 28, 2018

Haha yes :)

brandonkelly added a commit that referenced this issue Nov 29, 2018

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Nov 29, 2018

OK added for the next 3.1 beta release :)

@benface

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2018

That was fast!

@frankharrison-wj

This comment has been minimized.

Copy link
Author

commented Nov 29, 2018

Ah that's great! Was about to say that I'd not released my plugin anywhere, as it's probably not super-stable and relies on being used exactly as I use it! But glad to see I'm not going to need it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.