Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/porsager/rollup-plugin-svgo
✂️ A rollup plugin to import svg files processed with svgo
https://github.com/porsager/rollup-plugin-svgo
Last synced: 17 days ago
JSON representation
✂️ A rollup plugin to import svg files processed with svgo
- Host: GitHub
- URL: https://github.com/porsager/rollup-plugin-svgo
- Owner: porsager
- License: wtfpl
- Created: 2018-08-16T11:56:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-03T06:39:48.000Z (over 2 years ago)
- Last Synced: 2024-05-15T04:13:14.707Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 21
- Watchers: 4
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - svgo - Import SVG files as strings (Plugins / Other File Imports)
README
[![version](https://img.shields.io/npm/v/rollup-plugin-svgo.svg)]() [![license](https://img.shields.io/github/license/porsager/rollup-plugin-svgo.svg)]()
# ✂️ `rollup-plugin-svgo`
A rollup plugin to import svg files processed with [svgo](https://github.com/svg/svgo)
> SVG files, especially those exported from various editors, usually contain a lot of redundant and useless information. This can include editor metadata, comments, hidden elements, default or non-optimal values and other stuff that can be safely removed or converted without affecting the SVG rendering result.
## Usage
```bash
npm i -D rollup-plugin-svgo
``````js
import svgo from 'rollup-plugin-svgo'export default {
plugins: [
svgo(/* options */)
]
}
```### Options
If you want to skip any svgo processing you can pass
```js
{
raw: true
}
```
in options. This will import the svg content as is.Other options are passed directly to svgo to toggle various svgo plugins. You can find all plugins here: https://github.com/svg/svgo#what-it-can-do
Svgo options are a bit verbose to write, so see the defaults used below for how to do it:
### Defaults
```js
{
plugins: [{
removeViewBox: false
}, {
removeDimensions: true
}]
}
```