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 a hybrid symbol-sprite mode #678

Open
rinart73 opened this issue May 10, 2022 · 2 comments · May be fixed by #81
Open

Adding a hybrid symbol-sprite mode #678

rinart73 opened this issue May 10, 2022 · 2 comments · May be fixed by #81

Comments

@rinart73
Copy link

In this article you can see symbol svg images that can also be used as background sprites. The article was published in 2015 but in seems that since then all browsers added support for this.
You basically define view ares and then via the use tag you display SVG symbols in them.

<symbol viewBox="0 0 32 32" id="symbol-one">...</symbol>
<symbol viewBox="0 0 32 32" id="symbol-two">...</symbol>
<view id="symbol-one-view" viewBox="0 0 32 32" />
<view id="symbol-two-view" viewBox="0 33 35 35" />
<use xlink:href="#symbol-one" width="32" height="32" x="0" y="0"></use>
<use xlink:href="#symbol-two" width="32" height="32" x="0" y="33"></use>

I think this could be a good addition to the modes.

@Kreeg Kreeg linked a pull request May 10, 2022 that will close this issue
3 tasks
@Kreeg
Copy link
Member

Kreeg commented May 10, 2022

Hello @rinart73! This one is already in development, but we encountered some issues. For more info you can check #81
We welcome any help. The development branch is https://github.com/svg-sprite/svg-sprite/tree/pr/81

@cotwitch
Copy link

cotwitch commented Sep 13, 2023

What a pity that this is still not possible :(

I think it would be really great to have just one external sprite/definition (which could be cached on client) and it could be usable as inline element (due to that it's contents/elements could be controlled via CSS) and simultaneously, it could be used as an CSS sprite. Without "hybrid/universal" mode this could not be achieved. Or am I wrong?

Technically I mean following:

HTML

  <svg>
    <use xlink:href="icons.svg#icon" />
  </svg>

CSS

  .icon {
    background-image: url(icons.svg#icon-view);
  }

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

Successfully merging a pull request may close this issue.

3 participants