Socket
Book a DemoInstallSign in
Socket

inline-svgo-loader

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inline-svgo-loader

use svgo to optimize svg file, transformed as inline string.

latest
Source
npmnpm
Version
4.0.0
Version published
Maintainers
1
Created
Source

inline-svgo-loader

Use svgo to optimize svg file, transformed as string or data-uri or file.

npm version Build Status

Options

  • svgo: SVGO.Options, configuration passed to svgo, see https://github.com/svg/svgo. (ps: datauri will be ignored.)
  • limit: number, when optimized svg file size is larger than limit, will use fallback option.
  • fallback: { loader: string, options: any }, see above, default fallback is file-loader.

Usage

npm install inline-svgo-loader --save-dev
{
  module: {
    rules: [
      {
        test: /\.(svg)(\?.*)?$/,
        loader: 'inline-svgo-loader'options: {
          svgo: {},
          limit: 4 * 1024,
          fallback: {
            loader: 'file-loader',
            options: { name: '[name].svg' }
          }
        }
      }
    ]
  }
}

support data:image/svg+xml,

Just append datauri query param to svg file path to support data url(data:image/svg+xml,%3csvg..., Not base64).

eg: in css background-image: url('assets/some.svg?datauri').

This loader will ignore datauri in option svgo.

Keywords

svg

FAQs

Package last updated on 14 May 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.