craco-plugin-svg-sprite
v1.0.0
Published
craco-plugin for creating SVG sprites.
Downloads
85
Maintainers
Readme
craco-plugin-svg-sprite
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:
|Property|Description|Type|Default|Option|
|:---:|:---:|:---:|:---:|:---:|
|include|files to include|string
|-|required|
|svgPrefixName|svg file prefix name|string
|-|option|
|compress|is a svgo used|boolean
|true|option|
|svgoConfig|svgo-loader config|object
|-|option|
|spriteLoaderConfig|svg-sprite-loader config|object
|-|option|