SVG sprite · Issue #204 · feathericons/feather · GitHub
Skip to content

SVG sprite #204

Closed
Closed

Description

@Swizz

Hi there,
I am gonna catch some updates !

Is the SVG sprite still under consideration for a future improvement ?

Activity

  1. colebemis commented on Oct 13, 2017

    @colebemis
    Member

    I've been pretty swamped with school and work. Do you want to open a PR?

    We currently have a node script called bin/build-svgs.js that processes all the SVGs from the icons direction and puts them in the dist/icons directory. To create an SVG sprite, all we should have to do is write a similar bin/build-sprite.js script that processes all the SVGs from the icons directory and combines them into a dist/feather-sprite.svg. You'd also have to do some research on current best practices for SVG sprites (because they change so frequently).

  2. wuweiweiwu commented on Jan 16, 2018

    @wuweiweiwu

    @colebemis is this still under works? I'd take it :)

  3. colebemis commented on Jan 16, 2018

    @colebemis
    Member

    @wuweiweiwu I don't think anyone is working on this right now. Feel free to take it on 👍

  4. ivanquirino commented on Feb 17, 2018

    @ivanquirino
    Contributor

    I may start working on this soon, I'm really needing it in sprite form, because I can't stand react-feather's one component per icon approach. I've already made an Icon helper component for using with Open Iconic's sprite so I think I'll follow Open Iconic's approach for the sprite.

  5. ivanquirino commented on Feb 17, 2018

    @ivanquirino
    Contributor

    I made a script that builds the sprite using dist/icons.json, so it must be run after the current main build. The SVG attributes of the inner linked file in the <use /> tag don't work, so the SVG attributes, class or style must be passed when using the inline SVG tag. Just like this:

    <svg [feather svg attributes, css class atrtibute, style attribute]>
      <use xlink:href="[spriteFileUrl]#[iconID]"/>
    </svg>

    The following CSS class was extracted from the default icon attributes and renders it nicely:

    .feather {
      width: 24px; 
      height: 24px; 
      stroke: currentColor; 
      stroke-width: 2; 
      stroke-linecap: round; 
      stroke-linejoin: round; 
      fill: none
    }

    As today is Saturday and I've had enough already, I'll write the tests on Monday and make a PR as soon as possible. The script and SVG file follows:
    build-sprite.zip

  6. ivanquirino commented on Feb 19, 2018

    @ivanquirino
    Contributor

    That's it: #319

  7. colebemis commented on May 21, 2018

    @colebemis
    Member

    Closed in #319

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions