Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spritemaker-svg

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spritemaker-svg

Create an SVG sprite map from SVG sprites

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Spritemaker for SVG

Build Status

Create an SVG sprite map from SVG sprites.

Installation

npm install spritemaker-svg

Use

var spritemaker = require('spritemaker-svg');

var sprites = [
	{ id: 'sprite1', stream: getSpriteReadableStream('sprite1') },
	{ id: 'sprite2', stream: getSpriteReadableStream('sprite2') },
	{ id: 'sprite3', stream: getSpriteReadableStream('sprite3') },
	{ id: 'sprite4', stream: getSpriteReadableStream('sprite4') }
]

var output = spritemaker(sprites);
// Pipe the resulting SVG somewhere.
output.pipe(process.stdout);
output.on('packed', function(data) {
	// The information about the sprite packing is available.

	// data.width: width of the resulting SVG
	// data.height: height of the resulting SVG
	// data.items: items within the sprite
	// data.items[0].id: the ID passed in.
	// data.items[0].x: the generated x coordinate of the sprite
	// data.items[0].x: the generated y coordinate of the sprite
	// data.items[0].width: the width of the sprite
	// data.items[0].height: the height of the sprite
});

Contributing

Contributing tests, documentation, or code is all appreciated. All code should be accompanied by valid tests.

Limitations

  • If two sprite SVGs have the same ID, it does not currently disambiguate them.

Keywords

FAQs

Package last updated on 21 Feb 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc