New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

vite-plugin-cssvg

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-cssvg

Vite plugin to transform SVG files into css/less/sass inline image

latest
Source
npmnpm
Version
2.0.6
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-cssvg

Static Badge Static Badge npm

Vite Plugin for svg in CSS/Less/SCSS

transform url(**/*.svg) to url('data:image/svg+xml;utf8,<svg>...</svg>')

eg

1. single imported svg

// index.css before transform
.some-class{
    background: url(/src/asset/a.svg) // support alias eg. url(/@/asset/a.svg)
}
// after 
.some-class{
    background: url('data:image/svg+xml;utf8,<svg>...</svg>')
}

2. imported svg used many times

// before
#root{
    --svg-a: url(/src/asset/a.svg)
}
.a-class{
    background: var(--svg-a)
}
.b-class{
    background: var(--svg-a)
}
// after
body{
    --svg-a: url('data:image/svg+xml;utf8,<svg>...</svg>')
}
.a-class{
    background: var(--svg-a)
}
.b-class{
    background: var(--svg-a)
}

params

1. exclude?: FilterPattern

defualt: undefined

2. include?: FilterPattern

defualt: [/\.s?css/, /\.less/]

3. inlineLimit?: number

default: 10 (kb)

LICENSE

GitHub

Keywords

transform SVG

FAQs

Package last updated on 17 Jan 2024

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