Socket
Book a DemoInstallSign in
Socket

craco-plugin-svg-sprite

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

craco-plugin-svg-sprite

craco-plugin for creating SVG sprites.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
5
66.67%
Maintainers
1
Weekly downloads
 
Created
Source

craco-plugin-svg-sprite

NPM version Downloads License

craco-plugin for creatin SVG sprites.

Motivation: How to use SVG sprites in a project.

prerequisite

You have to learn what SVG sprites.

then,Learn how to use SVGO to compress SVG.

Finally, summarize the application in the project

Three package involved:

Usage

npm install craco-plugin-svg-sprite --save-dev

... or with Yarn

yarn add craco-plugin-svg-sprite -D

Configuration

// craco.config.js   => plugins
const cracoPluginSvgSprite = require("craco-plugin-svg-sprite");

{
    plugin: cracoPluginSvgSprite,
    options: {
        include: "src",                 // required
        compress: true,                 // option
        svgoConfig: {                   // option

        },
        spriteLoaderConfig: {           // option

        },
        svgPrefixName: "icon"           // option
    },
}

configuration parameter:

PropertyDescriptionTypeDefaultOption
includefiles to includestring-required
svgPrefixNamesvg file prefix namestring-option
compressis a svgo usedbooleantrueoption
svgoConfigsvgo-loader configobject-option
spriteLoaderConfigsvg-sprite-loader configobject-option

reference

在 create-react-app 创建的项目中使用 svg-sprite-loader

Keywords

svgo

FAQs

Package last updated on 18 Dec 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