Code Monkey home page Code Monkey logo

svg-symbols's Introduction

svg-symbols's People

Contributors

kristoferjoseph avatar

Stargazers

Chas Turansky avatar Rubén Díaz-Jorge avatar Colin Baxter avatar Amanda Koster avatar Lukasz Ostrowski avatar Nuno Albuquerque avatar sect avatar Javier Diaz avatar Ondřej Ždych avatar Vlad Trukhin avatar Gavin Lynch avatar Nikolas Evers avatar Mike avatar Christophe avatar  avatar Bret Comnes avatar Nicolas Gryman avatar Pierre Bertet avatar Yosh avatar Dustin Senos avatar

Watchers

James Cloos avatar  avatar

svg-symbols's Issues

Option not to remove fill and stroke properties

Running svg-symbols removes the fill and stroke properties while creating the symbols SVG file. This can lead to color loss in the icons, if the project setup relies on this properties.

Suggested solution: would it be possible to pass additional arguments, i.e. svg-symbols ./directory-of-svgs > ./symbol-file.svg --keep-styles what would cause the script to preserve the stroke and fill properties? So the script would not run lines 24-26 if the argument is present?!

Lines in the code: https://github.com/kristoferjoseph/svg-symbols/blob/master/index.js#L25 and L26

Not every file gets proper attributes assigned?

Hi

I've been using this package and spent quite a lot time debugging different behavior of some of the icons from sprite.

I discovered not every symbol gets viewBox assigned. I though, basing on source code, it could be viewBox vs viewbox, but none of them works - but only for SOME icons.

Maybe you will help me discover why is this happening?

Take this svg:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">

<path style="fill:#D0021B;" d="M7.879,0.553l5.985,11.969c0.247,0.494,0.047,1.095-0.447,1.342
	c-0.139,0.069-0.292,0.106-0.447,0.106H1c-0.552,0-1-0.448-1-1c0-0.155,0.036-0.308,0.106-0.447L6.09,0.553
	c0.247-0.494,0.848-0.694,1.342-0.447C7.626,0.203,7.783,0.36,7.879,0.553z M5.985,7.989c0,0.552,0.448,1,1,1s1-0.448,1-1V4.99
	c0-0.552-0.448-1-1-1s-1,0.448-1,1V7.989z M5.985,10.988c0,0.552,0.448,1,1,1s1-0.448,1-1c0-0.552-0.448-1-1-1
	S5.985,10.436,5.985,10.988z"/>
</svg>

And the output

<symbol id="attention">

<path style="fill:#D0021B;" d="M7.879,0.553l5.985,11.969c0.247,0.494,0.047,1.095-0.447,1.342
	c-0.139,0.069-0.292,0.106-0.447,0.106H1c-0.552,0-1-0.448-1-1c0-0.155,0.036-0.308,0.106-0.447L6.09,0.553
	c0.247-0.494,0.848-0.694,1.342-0.447C7.626,0.203,7.783,0.36,7.879,0.553z M5.985,7.989c0,0.552,0.448,1,1,1s1-0.448,1-1V4.99
	c0-0.552-0.448-1-1-1s-1,0.448-1,1V7.989z M5.985,10.988c0,0.552,0.448,1,1,1s1-0.448,1-1c0-0.552-0.448-1-1-1
	S5.985,10.436,5.985,10.988z"/>
</symbol>

Remove style attr in addition to fill and stroke

@kristoferjoseph I have a need to remove the style attribute from the symbol nodes, in addition to the fill and stroke attributes which are already being removed. In my process for exporting SVG's, all styles are inlined into a style tag, which is good to have in the base file, but would be great if that was removed via this script.

      .children()
      .each(function (i, kid) {
        $(kid)
          .removeAttr('fill')
          .removeAttr('stroke')
          .removeAttr('style')
      })```


Thoughts?  I tried creating a branch on this project and submitting a pull request, but I don't have access to do so. 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.