# postcss-svg-slimming

> PostCSS plugin svg optimizer

Latest version **1.0.4** (published 2020-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-svg-slimming
pnpm add postcss-svg-slimming
yarn add postcss-svg-slimming
bun add postcss-svg-slimming
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-03-20 |
| First published | 2019-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 2 |
| Unpacked size | 38 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | benboba |
| Maintainers | benboba |
| Keywords | postcss, css, postcss-plugin, svg, optimizer |

## Links

- npm: https://www.npmjs.com/package/postcss-svg-slimming
- Repository: https://github.com/benboba/postcss-svg-slimming
- Homepage: https://github.com/benboba/postcss-svg-slimming#readme
- Issues: https://github.com/benboba/postcss-svg-slimming/issues
- npm.io page: https://npm.io/package/postcss-svg-slimming

## Dependencies (2)

- [postcss](https://npm.io/package/postcss.md) ^7.0.18
- [svg-slimming](https://npm.io/package/svg-slimming.md) ^1.5.3

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-03-20
- 1.0.3 — 2020-02-17
- 1.0.2 — 2020-01-22
- 1.0.1 — 2020-01-09
- 1.0.0 — 2019-12-04

## README

# PostCSS Svg Slimming

A [PostCSS](https://github.com/postcss/postcss) plugin that uses [svg-slimming](https://github.com/benboba/svg-slimming) to perform inline svg content in CSS optimization

The optimization effect indicates:

```css
/* Before optimization */
.foo {
		background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg"><rect width="100px" height="100px" fill="#ff0000"></rect></svg>');
}
```

```css
/* After optimization */
.foo {
	background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg"><path fill="red" d="M0,0H100V100H0z"/></svg>');
}
```

## use

Install this plugin

```
npm install postcss-svg-slimming -D
```

Configure the following in postcss.config.js:

```diff
module.exports = {
	plugins: [
+		require('postcss-svg-slimming'),
		...
	]
}
```

## parameter

This plugin supports a parameter of type object, which contains three valid attributes: base64, encode, and rules

### base64

Whether the output is base64 encoded

* Not configured (default)-determined by input
* true-force the output to be base64
* false-even if the input is base64, it will output utf8

### encode

Whether the output is url encode

**Note: When base64 is true, this option will have no effect**

* Not configured (default)-determined by input
* true-the output is forced to url encode
* false-the output will not be url encode (for compatibility reasons, # will be escaped)

### rules

[Please see the optimized configuration of svg-slimming](https://github.com/benboba/svg-slimming)

---
_Source: https://npm.io/package/postcss-svg-slimming · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
