Skip to content

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

License

Notifications You must be signed in to change notification settings

dabanlee/postcss-background-image-auto-size

Repository files navigation

postcss-background-image-auto-size

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

Get Started

Installation

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

Usage

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

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

Example

/* 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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published