Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Combines multiple SVG files into one using <symbol>
elements which you may <use>
in your markup. Heavily inspired by grunt-svgstore
and gulp-svgstore
, this is a standalone module that may be used in any asset pipeline.
$ npm install --save svgstore
var svgstore = require('svgstore');
var fs = require('fs');
var sprites = svgstore()
.add('unicorn', fs.readFileSync('./unicorn.svg', 'utf8'))
.add('rainbow', fs.readFileSync('./rainbow.svg', 'utf8'));
fs.writeFileSync('./sprites.svg', sprites);
The resulting file may be consumed in markup as external content.
<body>
<svg role="img"><use xlink:href="./sprites.svg#unicorn"/></svg>
<svg role="img"><use xlink:href="./sprites.svg#rainbow"/></svg>
</body>
See the examples directory for more detail.
options
{Object}
: Options for converting SVGs to symbolsCreates a container SVG sprites document.
The current cheerio instance.
id
{String}
Unique id
for this SVG file.svg
{String}
Raw source of the SVG file.options
{Object}
Same as the options of svgstore()
, but will only apply to this SVG file's <symbol>
.Appends a file to the sprite with the given id
.
options
{Object}
inline
{Boolean}
(default: false
) Don't output <?xml ?>
, DOCTYPE
, and the xmlns
attribute.Outputs sprite as a string of XML.
cleanDefs
{Boolean|Array}
(default: false
) Remove style
attributes from SVG definitions, or a list of attributes to remove.cleanSymbols
{Boolean|Array}
(default: false
) Remove style
attributes from SVG objects, or a list of attributes to remove.svgAttrs
{Boolean|Object}
(default: false
) A map of attributes to set on the root <svg>
element. If you set an attribute's value to null, you remove that attribute. Values may be functions like jQuery.symbolAttrs
{Boolean|Object}
(default: false
) A map of attributes to set on each <symbol>
element. If you set an attribute's value to null, you remove that attribute. Values may be functions like jQuery.copyAttrs
{Boolean|Array}
(default: false
) Attributes to have svgstore
attempt to copy to the newly created <symbol>
tag from it's source <svg>
tag. The viewBox
, aria-labelledby
, and role
attributes are always copied.renameDefs
{Boolean}
(default: false
) Rename defs
content ids to make them inherit files' names so that it would help to avoid defs with same ids in the output file.Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.
$ npm test
The svgstore organization began after it was noticed that the common build task of converting an <svg>
into a <symbol>
tag was being implemented in a similar manner by many different projects across the JavaScript ecosystem.
The long-term goal for this project, in particular, is to provide a single standalone module that can be plugged in to any asset pipeline, thus allowing pipeline tools to focus on providing clean APIs and interfaces related to their build process integration, rather than implementing/duplicating SVG conversion logic directly.
svgstore
:MIT © Shannon Moeller
FAQs
Combines mulitple svg files into one.
We found that svgstore demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.