![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
aisvg2sprite
Advanced tools
Convert illustrator(ai) SVG to pretty SVG sprite
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
How can i use SVG sprite in pages?
remove-fill
or remove-stroke
optionsymbol *: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
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
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
http://www.zhangxinxu.com/sp/svg.html
http://www.w3cplus.com/svg/styling-svg-use-content-css.html
FAQs
Convert illustrator(ai) SVG to pretty SVG sprite
We found that aisvg2sprite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.