A PostCSS plugin to add CSS rules
width
andheight
forbackground-image
automatically.
Get Started
Installation
$ yarn add postcss-background-image-auto-size --devCopy the code
Usage
// postcss.config.js
const autoSize = require('postcss-background-image-auto-size');
module.exports = {
plugins: [
autoSize(),
],
};Copy the code
Example
/* Before */
.logo {
background-image: url('./images/logo.png');
}
/* After */
.logo {
background-image: url('./images/logo.png');
width: 400px;
height: 400px;
}Copy the code
License
Licensed under the MIT License