# postcss-background-image-auto-size

> A PostCSS plugin to add CSS rules `width` and `height` for `background-image` automatically.

Latest version **1.0.4** (published 2020-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-background-image-auto-size
pnpm add postcss-background-image-auto-size
yarn add postcss-background-image-auto-size
bun add postcss-background-image-auto-size
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-09-18 |
| First published | 2019-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 24 |
| Author | 大板栗 |
| Maintainers | justclear |

## Links

- npm: https://www.npmjs.com/package/postcss-background-image-auto-size
- Repository: https://github.com/dabanlee/postcss-background-image-auto-size
- Homepage: https://github.com/dabanlee/postcss-background-image-auto-size#readme
- Issues: https://github.com/dabanlee/postcss-background-image-auto-size/issues
- npm.io page: https://npm.io/package/postcss-background-image-auto-size

## Dependencies (1)

- [image-size](https://npm.io/package/image-size.md) ^0.7.1

## Recent versions

- 1.0.4 (latest) — 2020-09-18
- 1.0.3 — 2020-08-20
- 1.0.2 — 2019-01-18
- 1.0.1 — 2019-01-17

## README

# postcss-background-image-auto-size

> A PostCSS plugin to add CSS rules `width` and `height` for `background-image` automatically.

## Get Started

### Installation

```sh
$ yarn add postcss-background-image-auto-size --dev
```

### Usage

```js
// postcss.config.js
const autoSize = require('postcss-background-image-auto-size');

module.exports = {
    plugins: [
        autoSize(),
    ],
};
```

### Example

```css
/* Before */
.logo {
    background-image: url('./images/logo.png');
}

/* After */
.logo {
    background-image: url('./images/logo.png');
    width: 400px;
    height: 400px;
}
```

## License

Licensed under the [MIT License](https://github.com/JustClear/postcss-background-image-auto-size/blob/master/LICENSE)

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