-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RFC: Feather SVG Icon System #101
Comments
Evil-icons looks very close to that you have in mind ; but the Like you said, the SVG Symbol Sprite need to be the single source of truth, according to this, the CDN loader need to encore the use of So, I discourage the use of class or |
I was actually thinking that the individual SVGs in the In terms of DOM injection, I'm doing some research on that right now. I'll post a write-up of my findings soon. |
Here are my ideas on ways Feather could be used: Option 1: Copy & PasteIf you only need one or two icons, copying and pasting the SVG code directly into your markup might be the best solution. This is by far the simplest way to use Feather. Option 2: NodeFor more advanced use cases, Feather could expose an Example: const feather = require('feather-icons');
feather.icons.mail
/* {
name: 'mail',
contents: '<path d="..."/><polyline points="..."/>',
options: {
class: 'feather feather-mail',
width: 24,
height: 24,
viewBox: '0 0 24 24',
fill: 'none',
stroke: 'currentColor',
'stroke-width': 2,
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
},
} */
feather.toSVG('mail', {})
// '<svg ...><path d="..."/><polyline points="..."/></svg>' This option would make Feather easier to use with front-end frameworks like React and Vue and would aid in the creation of packages like 'react-feather', 'vue-feather', etc. I imagine that this Option 3: JavaScript InjectionThe Example: <script src="/path/to/feather.min.js"></script>
<span class="feather" data-icon="mail"></span>
<script>
const icons = document.querySelectorAll('feather');
feather.inject(icons);
</script> This option would be good for prototyping in the browser because it could utilize a CDN. Option 4: SpritesheetFeather could generate an SVG sprite by looping over every key in <svg><use xlink:href="#mail"/></svg> or just reference <svg><use xlink:href="/path/to/feather.svg#mail"></svg> I know IE has some problems referencing external SVGs in this way so we would probably have to provide a polyfill of some kind. Final ThoughtsI'd like to keep the main I'd love to get feedback on these ideas. Let me know if you have any ideas about how to best deliver Feather. I want to design the best possible experience for Feather users before getting in the weeds with implementation details. |
Just published react-feather. |
@mage3k @carmelopullara I just merged a pull request adding a Related Projects to the README. I'd love for you guys to add your projects to the list. Just submit a pull request 👍 |
@colebemis just submitted. Thanks! |
With this issue closed, is there one tracking the progress of SVG sprite? |
This is a place to discuss how to best implement an SVG Icon System for Feather. This is a continuation of the discussions in #47 and #41. The goal of this thread is to define a usage spec for Feather.
Here's the consensus so far:
icons
directory should remain the single source of truth.icons
directory.icons
object to make the NPM package more useful.react-feather
,vue-feather
, etc.).Related reading:
Other SVG icon systems:
The text was updated successfully, but these errors were encountered: