npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aisvg2sprite

v1.0.0

Published

Convert illustrator(ai) SVG to pretty SVG sprite

Downloads

21

Readme

aisvg2sprite

Convert illustrator(ai) SVG to pretty SVG sprite

Usage

npm install -g aisvg2sprite
  Usage: aisvg2sprite <file> <output> [options]

  Options:

    -h, --help                     output usage information
    -V, --version                  output the version number
    -v                             get version
    -f, --remove-fill [pattern]    remove fill attributes by [pattern](default [a-f0-9])
    -s, --remove-stroke [pattern]  remove stroke attributes by [pattern](default [a-f0-9])
    -m, --minimize                 minimize output svg file
    -d, --demo                     create demo.html

Tips

How can i use SVG sprite in pages?

Without remove-fill or remove-stroke option

symbol *:not([style*="fill:none"]) {fill:inherit!important;}
symbol *:not([style*="stroke:none"]) {stroke:inherit!important;}
.icon {width:50px;height:50px;}
.icon > use {stroke:red;stroke-width:0;fill:green;}
<svg class="icon"><use xlink:href="#i001"></use></svg>

See /usage/withoutOptions/demo.html

With remove-fill or remove-stroke option

.icon {width:50px;height:50px;stroke:red;stroke-width:0;fill:green;}
<svg class="icon"><use xlink:href="#i001"></use></svg>

See /usage/withOptions/demo.html

examples

  • no output: aisvg2sprite examples/icon.svg -> examples/icon.min.svg

  • output is directory: aisvg2sprite examples/icon.svg examples/default -> examples/default/icon.svg

  • output is file: aisvg2sprite examples/icon.svg examples/default2/default2icon.svg -> examples/default2/default2icon.svg

  • create demo: aisvg2sprite examples/icon.svg examples/demo -d -> examples/demo/icon.svg & examples/demo/demo.html

  • minimize svg: aisvg2sprite examples/icon.svg examples/minimize -m -> examples/minimize/icon.svg

  • remove fill attributes: aisvg2sprite examples/icon.svg examples/removeFill -f -> examples/removeFill/icon.svg

  • remove fill attributes by f(fill:#ffffff): aisvg2sprite examples/icon.svg examples/removeFill2 -f f -> examples/removeFill2/icon.svg

  • remove stroke attributes: aisvg2sprite examples/icon.svg examples/removeStroke -s -> examples/removeStroke/icon.svg

  • with all options and fill pattern is f: aisvg2sprite examples/icon.svg examples/all -f f -s -d -m -> examples/all/icon.svg & examples/all/demo.html

  • with all options and output is file: aisvg2sprite examples/icon.svg examples/all2/icon.min.svg -f -s -d -m -> examples/all2/icon.min.svg & examples/all2/demo.html

  • with all options and output is file, but the extname of output isnt .svg: aisvg2sprite examples/icon.svg examples/all2/icon.min -f -s -d -m -> examples/all2/icon.min.svg & examples/all2/demo.html

Thanks:

http://www.zhangxinxu.com/sp/svg.html

http://www.w3cplus.com/svg/styling-svg-use-content-css.html

License

MIT