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

svg-sprite-loader

Package Overview
Dependencies
Maintainers
4
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-sprite-loader

Webpack loader for creating SVG sprites

  • 6.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
196K
decreased by-2.97%
Maintainers
4
Weekly downloads
 
Created

What is svg-sprite-loader?

svg-sprite-loader is a Webpack loader that optimizes SVG files by creating SVG sprites. This allows for efficient use of SVGs in web applications by reducing the number of HTTP requests and improving performance.

What are svg-sprite-loader's main functionalities?

Basic Usage

This configuration sets up svg-sprite-loader to process SVG files and generate symbols with IDs based on the file name.

module.exports = {
  module: {
    rules: [
      {
        test: /\.svg$/,
        loader: 'svg-sprite-loader',
        options: {
          symbolId: 'icon-[name]'
        }
      }
    ]
  }
};

Custom Sprite Filename

This configuration extracts the SVGs into a single sprite file named 'custom-sprite.svg'.

module.exports = {
  module: {
    rules: [
      {
        test: /\.svg$/,
        loader: 'svg-sprite-loader',
        options: {
          extract: true,
          spriteFilename: 'custom-sprite.svg'
        }
      }
    ]
  }
};

Using with SVGO

This configuration uses svg-sprite-loader in combination with svgo-loader to optimize SVG files before creating the sprite.

module.exports = {
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          'svg-sprite-loader',
          {
            loader: 'svgo-loader',
            options: {
              plugins: [
                { removeTitle: true },
                { convertColors: { shorthex: false } },
                { convertPathData: false }
              ]
            }
          }
        ]
      }
    ]
  }
};

Other packages similar to svg-sprite-loader

Keywords

FAQs

Package last updated on 18 Oct 2021

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