Socket
Socket
Sign inDemoInstall

rollup-plugin-svgsprite-generator

Package Overview
Dependencies
Maintainers
6
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-svgsprite-generator

Create external svg sprite


Version published
Maintainers
6
Created
Source

Rollup Plugin - SVG Sprite Generator

This rollup plugin allows you to generate an external SVG sprite file.

Installation

Run the following console command to install the plugin:

npm i rollup-plugin-svgsprite-generator

Usage

In the rollup.config.js file, import the plugin and specify the input and output folders:

 import { svgSprite } from 'rollup-plugin-svgsprite-generator';
 ...
 export default [
    {
       ...
       plugins:[
         svgSprite({
            input: 'folder-that-contains-the-svg-file',
            output: 'path-where-to-generate-the-sprite',
         })
       ]
    }
 ]

Configuration Options

You can specify the following generation options:

minify

Type: boolean | Default value: true

Specifies whether to minify the sprite.

doctype

Type: boolean | Default value: true

Specifies whether to include the DOCTYPE header.

xml

Type: boolean | Default value: true

Specifies whether to include the <xml> tag.

inlineStyles

Type: boolean | Default value: true

Specifies whether to use inline styles instead of CSS classes in tags.

idConvert

Type: function | Default value: id => id

Modifies the id attribute for the <symbol> tag. Accepts and returns a string value.

styleModification

Type: function | Default value: id => id

Modifies inline SVG styles. Accepts and returns an object.

output

Type: string

Specifies the file path to the output SVG sprite.

input

Type: string

Specifies the folder that contains input SVG files.

hash

Type: boolean | Default value: false

Specifies whether to add hash to the output file name.

postGenerate

Type: function | Default value: (ids, outputFileName) => { }

A callback function executed after the sprite is generated. Accepts IDs of input files and the output file name.

Keywords

FAQs

Package last updated on 15 Feb 2023

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