Socket
Socket
Sign inDemoInstall

svg-sprite

Package Overview
Dependencies
Maintainers
2
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-sprite

SVG sprites & stacks galore — A low-level Node.js module that takes a bunch of SVG files, optimizes them and bakes them into SVG sprites of several types along with suitable stylesheet resources (e.g. CSS, Sass, LESS, Stylus, etc.)


Version published
Weekly downloads
133K
decreased by-2.35%
Maintainers
2
Weekly downloads
 
Created

What is svg-sprite?

The svg-sprite npm package is a powerful tool for creating SVG sprites. It allows you to combine multiple SVG files into a single file, which can then be used to optimize the delivery and performance of SVG assets in web applications. The package supports various modes of sprite generation, including symbol, stack, and CSS sprites, and provides a range of configuration options to customize the output.

What are svg-sprite's main functionalities?

Symbol Sprite Mode

This feature allows you to create a symbol sprite, which is a single SVG file containing multiple symbols. Each symbol can be referenced individually using the <use> element in your HTML.

const svgSprite = require('svg-sprite');
const config = {
  mode: {
    symbol: {
      dest: 'out',
      sprite: 'symbol-sprite.svg'
    }
  }
};
svgSprite(config).then(() => console.log('Symbol sprite created!'));

CSS Sprite Mode

This feature allows you to create a CSS sprite, which is a single SVG file that can be used with CSS to display individual icons. The package can also generate the corresponding CSS file to use the sprite.

const svgSprite = require('svg-sprite');
const config = {
  mode: {
    css: {
      dest: 'out',
      sprite: 'css-sprite.svg',
      render: {
        css: true
      }
    }
  }
};
svgSprite(config).then(() => console.log('CSS sprite created!'));

Stack Sprite Mode

This feature allows you to create a stack sprite, which is a single SVG file containing multiple stacked SVG elements. Each element can be referenced individually using the <use> element in your HTML.

const svgSprite = require('svg-sprite');
const config = {
  mode: {
    stack: {
      dest: 'out',
      sprite: 'stack-sprite.svg'
    }
  }
};
svgSprite(config).then(() => console.log('Stack sprite created!'));

Other packages similar to svg-sprite

Keywords

FAQs

Package last updated on 10 Mar 2022

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