0.8.2 • Published 7 years ago

svg-icon v0.8.2

Weekly downloads
127
License
MIT
Repository
github
Last release
7 years ago

svg-icon

An ultimate svg icons collection DONE RIGHT, with over 10,000 SVG icons out of the box.

Homepage

Download

You can download as many SVG icons as you need in homepage, or download the whole collection via npm:

npm install svg-icon --save

custom element

files:

dist/
    ├── svg-icon-element.js
    └── svg-icon-element.css

usage:

<svg-icon url="http://leungwensen.github.io/svg-icon/dist/sprite/symbol/logos.svg" type="si-logos-javascript"></svg-icon>

limitation:

use it locally

# clone the project
git clone https://github.com/leungwensen/svg-icon.git
# install dependencies
cd svg-icon
npm i
# startup a local server
gulp

SVG icon collections

nameid prefixsourcesupported
ant-designant-http://ant.design/#/components/iconyes
bootstrapbootstrap-https://github.com/twbs/bootstrapyes
deviconsdev-https://github.com/vorillaz/deviconsyes
elusive-iconfontelusive-https://github.com/reduxframework/elusive-iconfontyes
entypoentypo-https://github.com/danielbruce/entypoyes
evil-iconsevil-https://github.com/outpunk/evil-iconsyes
flag-iconflag-https://github.com/lipis/flag-icon-cssyes
flat-uiflat-https://github.com/designmodo/Flat-UIyes
font-awesomeawesome-https://github.com/FortAwesome/Font-Awesomeyes
foundationfoundation-https://github.com/zurb/foundation-icon-fontsyes
game-iconsgame-https://github.com/game-icons/iconsyes
geomicons-opengeom-https://github.com/jxnblk/geomicons-openyes
icomoon-freeicomoon-https://github.com/Keyamoon/IcoMoon-Freeyes
ionconsionic-https://github.com/driftyco/ioniconsyes
makimaki-https://github.com/mapbox/makiyes
map-iconsmap-https://github.com/scottdejonge/map-iconsyes
material-designmaterial-https://github.com/google/material-design-iconsyes
metro-ui-cssmetro-https://github.com/olton/Metro-UI-CSSyes
mfglabs-iconsetmfglabs-https://github.com/MfgLabs/mfglabs-iconsetyes
octiconsoct-https://github.com/primer/octiconsyes
open-iconicopen-https://github.com/iconic/open-iconicyes
payment-fontpayment-https://github.com/vendocrat/PaymentFontyes
payment-webfontpayment-web-https://github.com/orlandotm/payment-webfontyes
semantic-ui(oct-/awesome-)https://github.com/Semantic-Org/Semantic-UI/yes
simple-iconssimple-https://github.com/danleech/simple-iconsyes
subwaysubway-https://github.com/mariuszostrowski/subwayyes
typiconstypcn-https://github.com/stephenhutchings/typicons.fontyes
weather-iconsweather-https://github.com/erikflowers/weather-iconsyes
windows-iconswindows-https://github.com/Templarian/WindowsIconsyes
zerozero-src/zeroyes
zocialzocial-https://github.com/smcllns/css-social-buttonsyes
logos(svg porn)logos-http://svgporn.comyes

Need more? Please leave an issue or a pull request.

Build your own collection

1. Install svg-icon via npm:

npm install svg-icon -g

2. Define a collection file (JSON format, demo)

3. Build it:

svg-icon build --source $path/to/icons.json --target $path/to/dest --name wow

Now you have a SVG sprite file and a demo page.

$path/to/dest/wow/
    ├── index.html
    └── svg-symbols.svg

Contribute

How did you collect all these SVG icons?

There are basically two kinds of icon collections, ones with SVG source files, and others with only icon fonts.

  • Those with SVG source files: I simply copy the icons to the dest folder, optimise them, trim the pads around every icon, and build an SVG sprite file from them.
  • Those with icon fonts: I need to separate every icon from a combined SVG font file(locating, transforming, etc.), optimise them, trim them, and build an SVG sprite.

So the data flow is like:

Sources(SVG icons/icon fonts) ---separating/copying---> SVG icons ---optimising---> mid products(dist/svg/*) ---trimming---> final products(dist/trimmed-svg/*) ---building---> SVG sprite

Is the contributing toolchain ready for me?

Yes, and no.

The collection of 10,000+ SVG icons is mostly collected by nodejs scripts(check out these folders for details bin/, gulp and lib ). But I still have to write some code when I want to add icons from a new vendor into this project, because of the uncertainty of icon collections.

If you are familiar with nodejs and SVG, and interested in making this collection more useful, please leave a PR. Feel free to contact me if you have any question.

Of course, the quickest way to add your favorite icons here is to leave an issue, and let me do the rest for you ;-).

References

Projects inspired svg-icon

Projects powered svg-icon

  • svgo: transforming and optimizing SVG icons would be impossible without this awesome project.
  • vinyl-fs: gulp and vinyl-fs helped me to process large amount of files without any pain.
  • phantomjs: it is the answer of lots of problems.
  • a lot more

Known issues